summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-06-18 13:45:56 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-09 16:42:22 -0700
commit6269b6b676310d9fa2560da49be618372b39acf4 (patch)
tree1cfc74bf1f6e342000cde5ee18cde1cecb631824 /sha1_name.c
parentaa1dec9ef6ff184792520eb4539af1555c01604c (diff)
downloadgit-6269b6b676310d9fa2560da49be618372b39acf4.tar.gz
sha1_name.c: get_describe_name() by definition groks only commits
Teach get_describe_name() to pass the disambiguation hint down the callchain to get_short_sha1(). Also add tests to show various syntactic elements that we could take advantage of the object type information to help disambiguration of abbreviated object names. Many of them are marked as broken, and some of them will be fixed in later patches in this series. 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 174d3df9b3..caef6e5e62 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -603,6 +603,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
static int get_describe_name(const char *name, int len, unsigned char *sha1)
{
const char *cp;
+ unsigned flags = GET_SHA1_QUIETLY | GET_SHA1_COMMIT;
for (cp = name + len - 1; name + 2 <= cp; cp--) {
char ch = *cp;
@@ -613,7 +614,7 @@ static int get_describe_name(const char *name, int len, unsigned char *sha1)
if (ch == 'g' && cp[-1] == '-') {
cp++;
len -= cp - name;
- return get_short_sha1(cp, len, sha1, GET_SHA1_QUIETLY);
+ return get_short_sha1(cp, len, sha1, flags);
}
}
}