aboutsummaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-20 14:39:48 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-20 14:39:48 -0800
commit07301eaa766efac7818eac7a4a6db0d0c3948d66 (patch)
treee8d278300591713f61fbdcc5213dedb7d742c0f2 /transport-helper.c
parentbd0d1916de221425fc22b69940ff71b0ce6aad9c (diff)
parentc1ceea1d273925fe6ecb0824e7ea08eb6e6e2635 (diff)
downloadgit-07301eaa766efac7818eac7a4a6db0d0c3948d66.tar.gz
git-07301eaa766efac7818eac7a4a6db0d0c3948d66.tar.xz
Merge branch 'tr/http-push-ref-status'
* tr/http-push-ref-status: transport-helper.c::push_refs(): emit "no refs" error message transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed transport.c::transport_push(): make ref status affect return value refactor ref status logic for pushing t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs t5541-http-push.sh: add tests for non-fast-forward pushes Conflicts: transport-helper.c
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/transport-helper.c b/transport-helper.c
index ca8fa92e6..fdf225622 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -528,24 +528,27 @@ static int push_refs(struct transport *transport,
return transport->push_refs(transport, remote_refs, flags);
}
- if (!remote_refs)
+ if (!remote_refs) {
+ fprintf(stderr, "No refs in common and none specified; doing nothing.\n"
+ "Perhaps you should specify a branch such as 'master'.\n");
return 0;
+ }
helper = get_helper(transport);
if (!data->push)
return 1;
for (ref = remote_refs; ref; ref = ref->next) {
- if (ref->peer_ref)
- hashcpy(ref->new_sha1, ref->peer_ref->new_sha1);
- else if (!mirror)
+ if (!ref->peer_ref && !mirror)
continue;
- ref->deletion = is_null_sha1(ref->new_sha1);
- if (!ref->deletion &&
- !hashcmp(ref->old_sha1, ref->new_sha1)) {
- ref->status = REF_STATUS_UPTODATE;
+ /* Check for statuses set by set_ref_status_for_push() */
+ switch (ref->status) {
+ case REF_STATUS_REJECT_NONFASTFORWARD:
+ case REF_STATUS_UPTODATE:
continue;
+ default:
+ ; /* do nothing */
}
if (force_all)
@@ -634,6 +637,15 @@ static int push_refs(struct transport *transport,
continue;
}
+ if (ref->status != REF_STATUS_NONE) {
+ /*
+ * Earlier, the ref was marked not to be pushed, so ignore the ref
+ * status reported by the remote helper if the latter is 'no match'.
+ */
+ if (status == REF_STATUS_NONE)
+ continue;
+ }
+
ref->status = status;
ref->remote_status = msg;
}