summaryrefslogtreecommitdiff
path: root/builtin/for-each-ref.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-06-24 12:21:51 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-06-24 12:21:52 -0700
commit9d71c5f408dabb94f21891f69de17aa72d4787c3 (patch)
treed1645bb0714e12e36b3c06300ef39f3d402c770f /builtin/for-each-ref.c
parentMerge branch 'sg/completion-commit-cleanup' (diff)
parentread_loose_refs(): treat NULL_SHA1 loose references as broken (diff)
downloadtgif-9d71c5f408dabb94f21891f69de17aa72d4787c3.tar.xz
Merge branch 'mh/reporting-broken-refs-from-for-each-ref'
"git for-each-ref" reported "missing object" for 0{40} when it encounters a broken ref. The lack of object whose name is 0{40} is not the problem; the ref being broken is. * mh/reporting-broken-refs-from-for-each-ref: read_loose_refs(): treat NULL_SHA1 loose references as broken read_loose_refs(): simplify function logic for-each-ref: report broken references correctly t6301: new tests of for-each-ref error handling
Diffstat (limited to 'builtin/for-each-ref.c')
-rw-r--r--builtin/for-each-ref.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index f7e51a7fad..cb7db230d3 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -866,6 +866,11 @@ static int grab_single_ref(const char *refname, const struct object_id *oid,
return 0;
}
+ if (flag & REF_ISBROKEN) {
+ warning("ignoring broken ref %s", refname);
+ return 0;
+ }
+
if (*cb->grab_pattern) {
const char **pattern;
int namelen = strlen(refname);