{"thread":{"id":"17240","subject":"[PATCH] builtin-fsck: fix off by one head count","startedAt":"2009-01-18T17:27:14Z","lastAt":"2009-01-18T17:27:14Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"101023","messageId":"20090118182714.78422d0e.chriscool@tuxfamily.org","threadId":"17240","inReplyTo":null,"subject":"[PATCH] builtin-fsck: fix off by one head count","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-01-18T17:27:14Z","receivedAt":"2009-01-18T17:27:14Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"According to the man page, if \"git fsck\" is passed one or more\nheads, it should verify connectivity and validity of only objects\nreachable from the heads it is passed.\n\nBut before this patch, when it was passed only one head, then it\nbehaved as if no heads were passed (that is it used the index file,\nall references in $GIT_DIR/refs/* and all reflogs). In fact it just\nignored the first head it was passed.\n\nIt looks like this bug was introduced when \"builtin-fsck.c\" was\nchanged to use \"parse_options\" (commit\n5ac0a2063e8f824f6e8ffb4d18de74c55aae7131).\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin-fsck.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\n\tSorry if you receive this patch more than once, but it\n\tseems that something did not work when I tried to send\n\tit to the mailing list before. \n\ndiff --git a/builtin-fsck.c b/builtin-fsck.c\nindex 5a08ec1..fb35554 100644\n--- a/builtin-fsck.c\n+++ b/builtin-fsck.c\n@@ -629,7 +629,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)\n \t}\n \n \theads = 0;\n-\tfor (i = 1; i < argc; i++) {\n+\tfor (i = 0; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n \t\tif (!get_sha1(arg, head_sha1)) {\n \t\t\tstruct object *obj = lookup_object(head_sha1);\n-- \n1.6.1.85.g8ffc\n"}]}