From: Junio C Hamano Date: Sat, 18 Apr 2009 04:42:12 +0000 (-0700) Subject: Merge branch 'bw/short-ref-strict' X-Git-Tag: v1.6.3-rc1~12 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a9b772a0116869f0f93e57ca0b49fd66325bb04a?ds=inline;hp=-c Merge branch 'bw/short-ref-strict' * bw/short-ref-strict: remote.c: use shorten_unambiguous_ref rev-parse: --abbrev-ref option to shorten ref name for-each-ref: utilize core.warnAmbiguousRefs for :short-format shorten_unambiguous_ref(): add strict mode --- a9b772a0116869f0f93e57ca0b49fd66325bb04a diff --combined remote.c index e4c89b8b6d,54230ad558..41c5b59736 --- a/remote.c +++ b/remote.c @@@ -1461,11 -1461,7 +1461,7 @@@ int format_tracking_info(struct branch return 0; base = branch->merge[0]->dst; - if (!prefixcmp(base, "refs/remotes/")) { - base += strlen("refs/remotes/"); - } else if (!prefixcmp(base, "refs/heads/")) { - base += strlen("refs/heads/"); - } + base = shorten_unambiguous_ref(base, 0); if (!num_theirs) strbuf_addf(sb, "Your branch is ahead of '%s' " "by %d commit%s.\n", @@@ -1504,7 -1500,7 +1500,7 @@@ static int one_local_ref(const char *re struct ref *get_local_heads(void) { - struct ref *local_refs, **local_tail = &local_refs; + struct ref *local_refs = NULL, **local_tail = &local_refs; for_each_ref(one_local_ref, &local_tail); return local_refs; }