summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-03-23 23:41:18 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-03-23 23:41:18 -0800
commit84a9b58c421f9b2d1cc6c195ed441fac48e60392 (patch)
treeb3862a8325f87bd5cf4948117da1b0269664ca13 /sha1_name.c
parentget_sha1_basic(): try refs/... and finally refs/remotes/$foo/HEAD (diff)
downloadtgif-84a9b58c421f9b2d1cc6c195ed441fac48e60392.tar.xz
sha1_name: warning ambiguous refs.
This makes sure that many commands that take refs on the command line to honor core.warnambiguousrefs configuration. Earlier, the commands affected by this patch did not read the configuration file. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 3adaec3167..4f92e12a8d 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -236,7 +236,7 @@ static int ambiguous_path(const char *path, int len)
static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
{
static const char *fmt[] = {
- "/%.*s",
+ "%.*s",
"refs/%.*s",
"refs/tags/%.*s",
"refs/heads/%.*s",
@@ -263,8 +263,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
pathname = git_path(*p, len, str);
if (!read_ref(pathname, this_result)) {
if (warn_ambiguous_refs) {
- if (already_found &&
- !memcmp(sha1, sha1_from_ref, 20))
+ if (already_found)
fprintf(stderr, warning, len, str);
already_found++;
}