Skip to content

Commit

Permalink
builtin-fsck: fix off by one head count
Browse files Browse the repository at this point in the history
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 <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Christian Couder authored and Junio C Hamano committed Jan 18, 2009
1 parent bf474e2 commit 3aed2fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-fsck.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
}

heads = 0;
for (i = 1; i < argc; i++) {
for (i = 0; i < argc; i++) {
const char *arg = argv[i];
if (!get_sha1(arg, head_sha1)) {
struct object *obj = lookup_object(head_sha1);
Expand Down

0 comments on commit 3aed2fd

Please sign in to comment.