summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cache.h5
-rw-r--r--sha1_name.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index d0494c8533..7bd78ca282 100644
--- a/cache.h
+++ b/cache.h
@@ -1203,6 +1203,11 @@ struct object_context {
#define GET_SHA1_FOLLOW_SYMLINKS 0100
#define GET_SHA1_ONLY_TO_DIE 04000
+#define GET_SHA1_DISAMBIGUATORS \
+ (GET_SHA1_COMMIT | GET_SHA1_COMMITTISH | \
+ GET_SHA1_TREE | GET_SHA1_TREEISH | \
+ GET_SHA1_BLOB)
+
extern int get_sha1(const char *str, unsigned char *sha1);
extern int get_sha1_commit(const char *str, unsigned char *sha1);
extern int get_sha1_committish(const char *str, unsigned char *sha1);
diff --git a/sha1_name.c b/sha1_name.c
index faf873cf7f..0ff83a9985 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -327,6 +327,10 @@ static int get_short_sha1(const char *name, int len, unsigned char *sha1,
prepare_alt_odb();
memset(&ds, 0, sizeof(ds));
+
+ if (HAS_MULTI_BITS(flags & GET_SHA1_DISAMBIGUATORS))
+ die("BUG: multiple get_short_sha1 disambiguator flags");
+
if (flags & GET_SHA1_COMMIT)
ds.fn = disambiguate_commit_only;
else if (flags & GET_SHA1_COMMITTISH)