Skip to content

Commit c401cb4

Browse files
dschoJunio C Hamano
authored andcommitted
Warn about invalid refs
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 858cbfb commit c401cb4

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)