summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-04-20 22:50:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-20 22:50:37 (GMT)
commitc5da24a73a96a9908ae715f6430e65294115646a (patch)
tree4db197f483c8fd331cc149869da44d02c9ecacb2 /transport.c
parentaf78c317205ce254d9cc75fc0298ee86b579de73 (diff)
parent0aff719f489771c5e52259394d011c51317b118f (diff)
downloadgit-c5da24a73a96a9908ae715f6430e65294115646a.zip
git-c5da24a73a96a9908ae715f6430e65294115646a.tar.gz
git-c5da24a73a96a9908ae715f6430e65294115646a.tar.bz2
Merge branch 'ct/advise-push-default'
Break down the cases in which "git push" fails due to non-ff into three categories, and give separate advise messages for each case. 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 ea9dcb6..2dfac70 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;
+ }
}
}