remote: make _ls return the list directly

The callback-based method of listing remote references dates back to the
beginning of the network code's lifetime, when we didn't know any
better.

We need to keep the list around for update_tips() after disconnect() so
let's make use of this to simply give the user a pointer to the array so
they can write straightforward code instead of having to go through a
callback.
remote: fix a couple of leaks
remote: let's at least pretend to have some memory safety

Copy the pointers into temporary vectors instead of assigning them tot
he same array so we don't mess up with someone else's memory by
accident (e.g. by sorting).
tests: update push tests

These tests were forgotten when modifying git_remote_ls().
remote: update head list on push

A previous commit forgot to update the head list after push as well,
leading to wrong output of git_remote_ls().