summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-05-11 11:18:43 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-05-11 11:18:43 -0700
commit07e74b0da2896ffa6acb5c33f56d7266b35b7ac9 (patch)
treebe3f24134f5956774c7d5407231a31bab33d5616 /transport.c
parentMerge branch 'js/fast-import-test-9300' into maint (diff)
parentFix httpd tests that broke when non-ff push advice changed (diff)
downloadtgif-07e74b0da2896ffa6acb5c33f56d7266b35b7ac9.tar.xz
Merge branch 'ct/advise-push-default' into maint
The cases "git push" fails due to non-ff can be broken into three categories; each case is given a separate advise message. By Christopher Tiwald (2) and Jeff King (1) * ct/advise-push-default: Fix httpd tests that broke when non-ff push advice changed clean up struct ref's nonfastforward field push: Provide situational hints for non-fast-forward errors
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/transport.c b/transport.c
index ea9dcb6612..2dfac700b6 100644
--- a/transport.c
+++ b/transport.c
@@ -721,6 +721,10 @@ void transport_print_push_status(const char *dest, struct ref *refs,
{
struct ref *ref;
int n = 0;
+ unsigned char head_sha1[20];
+ char *head;
+
+ head = resolve_refdup("HEAD", head_sha1, 1, NULL);
if (verbose) {
for (ref = refs; ref; ref = ref->next)
@@ -738,8 +742,13 @@ void transport_print_push_status(const char *dest, struct ref *refs,
ref->status != REF_STATUS_UPTODATE &&
ref->status != REF_STATUS_OK)
n += print_one_push_status(ref, dest, n, porcelain);
- if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD)
- *nonfastforward = 1;
+ if (ref->status == REF_STATUS_REJECT_NONFASTFORWARD &&
+ *nonfastforward != NON_FF_HEAD) {
+ if (!strcmp(head, ref->name))
+ *nonfastforward = NON_FF_HEAD;
+ else
+ *nonfastforward = NON_FF_OTHER;
+ }
}
}