summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-02-11 17:22:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-11 17:22:16 (GMT)
commit9e5b80cd87a511f3403b6f88f87ef40844695f6b (patch)
tree3b24c61a7001a0cda2310e8d88f3cc0231dff567 /sha1_name.c
parentaff4e8dc217bdde9276e634ea7bf92adf926e573 (diff)
downloadgit-9e5b80cd87a511f3403b6f88f87ef40844695f6b.zip
git-9e5b80cd87a511f3403b6f88f87ef40844695f6b.tar.gz
git-9e5b80cd87a511f3403b6f88f87ef40844695f6b.tar.bz2
Squelch overzealous "ignoring dangling symref" in an empty repository
057e713 (Warn use of "origin" when remotes/origin/HEAD is dangling, 2009-02-08) tried to warn dangling refs/remotes/origin/HEAD only when "origin" was used to refer to it. There was one corner case a symref is expected to be dangling and this warning is unwarranted: HEAD in an empty repository. This squelches the warning for this special case. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 3bd2ef0..2f75179 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -278,7 +278,8 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
*ref = xstrdup(r);
if (!warn_ambiguous_refs)
break;
- } else if (flag & REF_ISSYMREF)
+ } else if ((flag & REF_ISSYMREF) &&
+ (len != 4 || strcmp(str, "HEAD")))
warning("ignoring dangling symref %s.", fullref);
}
free(last_branch);