{"thread":{"id":"18562","subject":"[PATCH 09/10] bisect: implement \"read_bisect_paths\" to read paths in \"$GIT_DIR/BISECT_NAMES\"","startedAt":"2009-03-26T04:55:59Z","lastAt":"2009-03-27T00:18:16Z","messageCount":3,"participants":["Christian Couder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"109483","messageId":"20090326055559.743cb502.chriscool@tuxfamily.org","threadId":"18562","inReplyTo":null,"subject":"[PATCH 09/10] bisect: implement \"read_bisect_paths\" to read paths in \"$GIT_DIR/BISECT_NAMES\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-03-26T04:55:59Z","receivedAt":"2009-03-26T04:55:59Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This is needed because  \"git bisect--helper\" must read bisect paths\nin \"$GIT_DIR/BISECT_NAMES\", so that a bisection can be performed only\non commits that touches paths in this file.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n bisect.c |   56 +++++++++++++++++++++++++++++++++++++++++++++++---------\n 1 files changed, 47 insertions(+), 9 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex ce62696..a6fd826 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -4,6 +4,7 @@\n #include \"revision.h\"\n #include \"refs.h\"\n #include \"list-objects.h\"\n+#include \"quote.h\"\n #include \"bisect.h\"\n \n \n@@ -424,6 +425,33 @@ static int read_bisect_refs(void)\n \treturn for_each_bisect_ref(register_ref, NULL);\n }\n \n+void read_bisect_paths()\n+{\n+\tstruct strbuf str = STRBUF_INIT;\n+\tconst char *filename = git_path(\"BISECT_NAMES\");\n+\tFILE *fp = fp = fopen(filename, \"r\");\n+\n+\tif (!fp)\n+\t\tdie(\"Could not open file '%s': %s\", filename, strerror(errno));\n+\n+\twhile (strbuf_getline(&str, fp, '\\n') != EOF) {\n+\t\tchar *quoted, *dequoted;\n+\t\tstrbuf_trim(&str);\n+\t\tquoted = strbuf_detach(&str, NULL);\n+\t\tif (!*quoted)\n+\t\t\tcontinue;\n+\t\tdequoted = sq_dequote(quoted);\n+\t\tif (!dequoted)\n+\t\t\tdie(\"Badly quoted content in file '%s': %s\",\n+\t\t\t    filename, quoted);\n+\t\tALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);\n+\t\trev_argv[rev_argv_nr++] = dequoted;\n+\t}\n+\n+\tstrbuf_release(&str);\n+\tfclose(fp);\n+}\n+\n static int skipcmp(const void *a, const void *b)\n {\n \treturn hashcmp(a, b);\n@@ -485,14 +513,11 @@ struct commit_list *filter_skipped(struct commit_list *list,\n \treturn filtered;\n }\n \n-int bisect_next_vars(const char *prefix)\n+static void bisect_rev_setup(struct rev_info *revs, const char *prefix)\n {\n-\tstruct rev_info revs;\n-\tint reaches = 0, all = 0;\n-\n-\tinit_revisions(&revs, prefix);\n-\trevs.abbrev = 0;\n-\trevs.commit_format = CMIT_FMT_UNSPECIFIED;\n+\tinit_revisions(revs, prefix);\n+\trevs->abbrev = 0;\n+\trevs->commit_format = CMIT_FMT_UNSPECIFIED;\n \n \t/* argv[0] will be ignored by setup_revisions */\n \tALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);\n@@ -504,9 +529,22 @@ int bisect_next_vars(const char *prefix)\n \tALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);\n \trev_argv[rev_argv_nr++] = xstrdup(\"--\");\n \n-\tsetup_revisions(rev_argv_nr, rev_argv, &revs, NULL);\n+\tread_bisect_paths();\n+\n+\tALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);\n+\trev_argv[rev_argv_nr++] = NULL;\n+\n+\tsetup_revisions(rev_argv_nr, rev_argv, revs, NULL);\n+\n+\trevs->limited = 1;\n+}\n+\n+int bisect_next_vars(const char *prefix)\n+{\n+\tstruct rev_info revs;\n+\tint reaches = 0, all = 0;\n \n-\trevs.limited = 1;\n+\tbisect_rev_setup(&revs, prefix);\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(\"revision walk setup failed\");\n-- \n1.6.2.1.317.g3d804\n"},{"id":"109494","messageId":"7vwsacrd6x.fsf@gitster.siamese.dyndns.org","threadId":"18562","inReplyTo":"20090326055559.743cb502.chriscool@tuxfamily.org","subject":"Re: [PATCH 09/10] bisect: implement \"read_bisect_paths\" to read paths in \"$GIT_DIR/BISECT_NAMES\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-26T06:49:26Z","receivedAt":"2009-03-26T06:49:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> This is needed because  \"git bisect--helper\" must read bisect paths\n> in \"$GIT_DIR/BISECT_NAMES\", so that a bisection can be performed only\n> on commits that touches paths in this file.\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n\nAgain, very nice.\n\n>  bisect.c |   56 +++++++++++++++++++++++++++++++++++++++++++++++---------\n>  1 files changed, 47 insertions(+), 9 deletions(-)\n>\n> diff --git a/bisect.c b/bisect.c\n> index ce62696..a6fd826 100644\n> --- a/bisect.c\n> +++ b/bisect.c\n> @@ -4,6 +4,7 @@\n>  #include \"revision.h\"\n>  #include \"refs.h\"\n>  #include \"list-objects.h\"\n> +#include \"quote.h\"\n>  #include \"bisect.h\"\n>  \n>  \n> @@ -424,6 +425,33 @@ static int read_bisect_refs(void)\n>  \treturn for_each_bisect_ref(register_ref, NULL);\n>  }\n>  \n> +void read_bisect_paths()\n> +{\n> +\tstruct strbuf str = STRBUF_INIT;\n> +\tconst char *filename = git_path(\"BISECT_NAMES\");\n> +\tFILE *fp = fp = fopen(filename, \"r\");\n\ns/= fp //;\n"},{"id":"109586","messageId":"200903270118.16564.chriscool@tuxfamily.org","threadId":"18562","inReplyTo":"7vwsacrd6x.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 09/10] bisect: implement \"read_bisect_paths\" to read paths in \"$GIT_DIR/BISECT_NAMES\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-03-27T00:18:16Z","receivedAt":"2009-03-27T00:18:16Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le jeudi 26 mars 2009, Junio C Hamano a écrit :\n> Christian Couder <chriscool@tuxfamily.org> writes:\n> > This is needed because  \"git bisect--helper\" must read bisect paths\n> > in \"$GIT_DIR/BISECT_NAMES\", so that a bisection can be performed only\n> > on commits that touches paths in this file.\n> >\n> > Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n>\n> Again, very nice.\n\nThanks, but I found a big bug in this patch.\nIt doesn't work when there is more than one path in \"$GIT_DIR/BISECT_NAMES\"\nbecause they are all on the same line, not on different lines.\nI will try to fix it soon and provide some test cases.\n\nBest regards,\nChristian.\n"}]}