summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-24 19:21:21 -0700
committerJunio C Hamano <gitster@pobox.com>2013-07-24 19:21:21 -0700
commit356df9bd8df58eb759fedaee8a8d1a7dc0872f8f (patch)
tree3ed41eb0da59c4a6e1b668c3392295ee334f978b /sha1_name.c
parent2bf3501150145d1f05678c20ab8e8d66f849851f (diff)
parentd099b7173dabdeeb1f339151ac2169b3a91bf631 (diff)
downloadgit-356df9bd8df58eb759fedaee8a8d1a7dc0872f8f.tar.gz
Merge branch 'jk/cat-file-batch-optim'
If somebody wants to only know on-disk footprint of an object without having to know its type or payload size, we can bypass a lot of code to cheaply learn it. * jk/cat-file-batch-optim: Fix some sparse warnings sha1_object_info_extended: pass object_info to helpers sha1_object_info_extended: make type calculation optional packed_object_info: make type lookup optional packed_object_info: hoist delta type resolution to helper sha1_loose_object_info: make type lookup optional sha1_object_info_extended: rename "status" to "type" cat-file: disable object/refname ambiguity check for batch mode
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 543bf9d9ec..0cf0c28a6f 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -452,13 +452,15 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
int at, reflog_len, nth_prior = 0;
if (len == 40 && !get_sha1_hex(str, sha1)) {
- refs_found = dwim_ref(str, len, tmp_sha1, &real_ref);
- if (refs_found > 0 && warn_ambiguous_refs) {
- warning(warn_msg, len, str);
- if (advice_object_name_warning)
- fprintf(stderr, "%s\n", _(object_name_msg));
+ if (warn_on_object_refname_ambiguity) {
+ refs_found = dwim_ref(str, len, tmp_sha1, &real_ref);
+ if (refs_found > 0 && warn_ambiguous_refs) {
+ warning(warn_msg, len, str);
+ if (advice_object_name_warning)
+ fprintf(stderr, "%s\n", _(object_name_msg));
+ }
+ free(real_ref);
}
- free(real_ref);
return 0;
}