Skip to content

Commit 3aed2fd

Browse files
chriscoolgitster
authored andcommitted
builtin-fsck: fix off by one head count
According to the man page, if "git fsck" is passed one or more heads, it should verify connectivity and validity of only objects reachable from the heads it is passed. However, since 5ac0a20 (Make builtin-fsck.c use parse_options., 2007-10-15) the command behaved as if no heads were passed, when given only one argument. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bf474e2 commit 3aed2fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin-fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
624624
}
625625

626626
heads = 0;
627-
for (i = 1; i < argc; i++) {
627+
for (i = 0; i < argc; i++) {
628628
const char *arg = argv[i];
629629
if (!get_sha1(arg, head_sha1)) {
630630
struct object *obj = lookup_object(head_sha1);

0 commit comments

Comments
 (0)