summaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-19 18:38:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-19 18:38:42 (GMT)
commit5d62e59e4c8a3632236bb609810c41b58b5f9b10 (patch)
tree9d85bc19aa0111d5aec8a689bf8167c4b24d78a7 /builtin/fsck.c
parent9c9fbee8f514046c5d1c79f70c507f82c77dbad2 (diff)
parent30d1038d1bd538bf2f8abfb5f5dccf80327a26c9 (diff)
downloadgit-5d62e59e4c8a3632236bb609810c41b58b5f9b10.zip
git-5d62e59e4c8a3632236bb609810c41b58b5f9b10.tar.gz
git-5d62e59e4c8a3632236bb609810c41b58b5f9b10.tar.bz2
Merge branch 'jk/fsck-exit-code-fix'
"git fsck" failed to report that it found corrupt objects via its exit status in some cases. * jk/fsck-exit-code-fix: fsck: return non-zero status on missing ref tips fsck: exit with non-zero status upon error from fsck_obj()
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index d42a27d..0928a98 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -388,7 +388,8 @@ static void fsck_sha1_list(void)
unsigned char *sha1 = entry->sha1;
sha1_list.entry[i] = NULL;
- fsck_sha1(sha1);
+ if (fsck_sha1(sha1))
+ errors_found |= ERROR_OBJECT;
free(entry);
}
sha1_list.nr = 0;
@@ -488,6 +489,7 @@ static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int f
obj = parse_object(sha1);
if (!obj) {
error("%s: invalid sha1 pointer %s", refname, sha1_to_hex(sha1));
+ errors_found |= ERROR_REACHABLE;
/* We'll continue with the rest despite the error.. */
return 0;
}
@@ -504,7 +506,7 @@ static void get_default_heads(void)
{
if (head_points_at && !is_null_sha1(head_sha1))
fsck_handle_ref("HEAD", head_sha1, 0, NULL);
- for_each_ref(fsck_handle_ref, NULL);
+ for_each_rawref(fsck_handle_ref, NULL);
if (include_reflogs)
for_each_reflog(fsck_handle_reflog, NULL);