summaryrefslogtreecommitdiff
path: root/src/push.c
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2013-02-08 15:00:08 -0500
committerPhilip Kelley <phkelley@hotmail.com>2013-02-08 15:21:37 -0500
commitdf93a6810a406308156b90f8e077d33383575774 (patch)
tree55d8061ff41c1f6716e2b7e414d0983e3390b730 /src/push.c
parentff9df88396c79d16f560308ce1b874682868ba8f (diff)
downloadlibgit2-df93a6810a406308156b90f8e077d33383575774.tar.gz
Merge the push report into the refs to avoid a 3rd network call
Diffstat (limited to 'src/push.c')
-rw-r--r--src/push.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/push.c b/src/push.c
index ddfe5ec07..64aaead6e 100644
--- a/src/push.c
+++ b/src/push.c
@@ -14,6 +14,20 @@
#include "vector.h"
#include "push.h"
+static int push_spec_rref_cmp(const void *a, const void *b)
+{
+ const push_spec *push_spec_a = a, *push_spec_b = b;
+
+ return strcmp(push_spec_a->rref, push_spec_b->rref);
+}
+
+static int push_status_ref_cmp(const void *a, const void *b)
+{
+ const push_status *push_status_a = a, *push_status_b = b;
+
+ return strcmp(push_status_a->ref, push_status_b->ref);
+}
+
int git_push_new(git_push **out, git_remote *remote)
{
git_push *p;
@@ -27,12 +41,12 @@ int git_push_new(git_push **out, git_remote *remote)
p->remote = remote;
p->report_status = 1;
- if (git_vector_init(&p->specs, 0, NULL) < 0) {
+ if (git_vector_init(&p->specs, 0, push_spec_rref_cmp) < 0) {
git__free(p);
return -1;
}
- if (git_vector_init(&p->status, 0, NULL) < 0) {
+ if (git_vector_init(&p->status, 0, push_status_ref_cmp) < 0) {
git_vector_free(&p->specs);
git__free(p);
return -1;