Merge branch 'bw/short-ref-strict'
authorJunio C Hamano <gitster@pobox.com>
Sat, 18 Apr 2009 04:42:12 +0000 (21:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 18 Apr 2009 04:42:12 +0000 (21:42 -0700)
* 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

1  2 
remote.c
diff --combined remote.c
index e4c89b8b6d255a781708a035e90de0c68e233f7f,54230ad5585885c83ebde249e6325ebd68ef4ec6..41c5b59736e7c470f5bd1a52ffaf4cd547238994
+++ 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;
  }