};
#define GET_SHA1_QUIETLY 01
+#define GET_SHA1_COMMIT 02
extern int get_sha1(const char *str, unsigned char *sha1);
extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
return 0;
}
+static int disambiguate_commit_only(const unsigned char *sha1, void *cb_data_unused)
+{
+ int kind = sha1_object_info(sha1, NULL);
+ return kind == OBJ_COMMIT;
+}
+
static int get_short_sha1(const char *name, int len, unsigned char *sha1,
unsigned flags)
{
prepare_alt_odb();
memset(&ds, 0, sizeof(ds));
+ if (flags & GET_SHA1_COMMIT)
+ ds.fn = disambiguate_commit_only;
+
find_short_object_filename(len, hex_pfx, &ds);
find_short_packed_object(len, bin_pfx, &ds);
status = finish_object_disambiguation(&ds, sha1);