[PATCH] builtin-fsck: fix off by one head count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

But before this patch, when it was passed only one head, then it
behaved as if no heads were passed (that is it used the index file,
all references in $GIT_DIR/refs/* and all reflogs). In fact it just
ignored the first head it was passed.

It looks like this bug was introduced when "builtin-fsck.c" was
changed to use "parse_options" (commit
5ac0a2063e8f824f6e8ffb4d18de74c55aae7131).

Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
---
 builtin-fsck.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

	Sorry if you receive this patch more than once, but it
	seems that something did not work when I tried to send
	it to the mailing list before. 

diff --git a/builtin-fsck.c b/builtin-fsck.c
index 5a08ec1..fb35554 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -629,7 +629,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);
-- 
1.6.1.85.g8ffc

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux