summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-07-24 19:21:21 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-07-24 19:21:21 -0700
commit356df9bd8df58eb759fedaee8a8d1a7dc0872f8f (patch)
tree3ed41eb0da59c4a6e1b668c3392295ee334f978b /sha1_name.c
parentMerge branch 'ml/avoid-using-grep-on-crlf-files' (diff)
parentFix some sparse warnings (diff)
downloadtgif-356df9bd8df58eb759fedaee8a8d1a7dc0872f8f.tar.xz
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;
}