diff options
author | Vicent Martà <vicent@github.com> | 2013-11-11 18:47:15 +0400 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-11-11 18:47:15 +0400 |
commit | 6414fd338df89eaa5bd4c64f7ab310fb7d5758bb (patch) | |
tree | 4af0ea37b387c791bd89e73edea10e3353c54423 /src/push.c | |
parent | 5e1281f873e7eb5b51569ef33218dd20b69ff707 (diff) | |
parent | a6192d7c98976edb0ce4fd10438ac7a19c283598 (diff) |
Merge pull request #1956 from libgit2/cmn/fetch-default-head
Remote revamp (director's cut)
Diffstat (limited to 'src/push.c')
-rw-r--r-- | src/push.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/push.c b/src/push.c index a799db8d0..4f442c6a2 100644 --- a/src/push.c +++ b/src/push.c @@ -616,16 +616,22 @@ on_error: return error; } -static int cb_filter_refs(git_remote_head *ref, void *data) -{ - git_remote *remote = (git_remote *) data; - return git_vector_insert(&remote->refs, ref); -} - static int filter_refs(git_remote *remote) { + const git_remote_head **heads; + size_t heads_len, i; + git_vector_clear(&remote->refs); - return git_remote_ls(remote, cb_filter_refs, remote); + + if (git_remote_ls(&heads, &heads_len, remote) < 0) + return -1; + + for (i = 0; i < heads_len; i++) { + if (git_vector_insert(&remote->refs, heads[i]) < 0) + return -1; + } + + return 0; } int git_push_finish(git_push *push) |