Skip to content

Commit b6b626f

Browse files
author
Junio C Hamano
committed
Merge branch 'js/refs'
* js/refs: Warn about invalid refs
2 parents 0093154 + c401cb4 commit b6b626f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

refs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,15 @@ static int do_for_each_ref(const char *base, int (*fn)(const char *path, const u
151151
break;
152152
continue;
153153
}
154-
if (read_ref(git_path("%s", path), sha1) < 0)
154+
if (read_ref(git_path("%s", path), sha1) < 0) {
155+
fprintf(stderr, "%s points nowhere!", path);
155156
continue;
156-
if (!has_sha1_file(sha1))
157+
}
158+
if (!has_sha1_file(sha1)) {
159+
fprintf(stderr, "%s does not point to a valid "
160+
"commit object!", path);
157161
continue;
162+
}
158163
retval = fn(path, sha1);
159164
if (retval)
160165
break;

0 commit comments

Comments
 (0)