]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin-fsck: fix off by one head count
authorChristian Couder <chriscool@tuxfamily.org>
Sun, 18 Jan 2009 03:46:09 +0000 (04:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 18 Jan 2009 06:37:41 +0000 (22:37 -0800)
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>
builtin-fsck.c

index 30971ce0ad170350cc6aaa2d213d348c267263db..aa4b239e42e8ade25cb481c4cdb55866eb37d948 100644 (file)
@@ -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);