{"thread":{"id":"39533","subject":"[PATCH 1/2] git-bisect.sh : create a file if the bisection is in old/new mode, named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program without having to read BISECT_TERMS. This will have to be changed in further versions if new terms are introduced.","startedAt":"2015-06-05T16:34:20Z","lastAt":"2015-06-08T11:54:57Z","messageCount":8,"participants":["Louis Stuber","Eric Sunshine","Christian Couder","Louis-Alexandre Stuber","Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"263032","messageId":"1433522061-14532-1-git-send-email-stuberl@ensimag.grenoble-inp.fr","threadId":"39533","inReplyTo":null,"subject":"[PATCH 1/2] git-bisect.sh : create a file if the bisection is in old/new mode, named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program without having to read BISECT_TERMS. This will have to be changed in further versions if new terms are introduced.","fromName":"Louis Stuber","fromEmail":"stuberl@ensimag.grenoble-inp.fr","sentAt":"2015-06-05T16:34:20Z","receivedAt":"2015-06-05T16:34:20Z","isPatch":true,"sender":{"key":"stuberl@ensimag.grenoble-inp.fr","avatar":null},"body":"\nSigned-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>\nSigned-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>\n---\n git-bisect.sh |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 109bd65..d3d19cb 100644\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -183,6 +183,10 @@ bisect_start() {\n \tthen\n \t\techo \"$BISECT_BAD\" >\"$GIT_DIR/BISECT_TERMS\" &&\n \t\techo \"$BISECT_GOOD\" >>\"$GIT_DIR/BISECT_TERMS\"\n+\t\tif test \"$BISECT_BAD\" = \"new\"\n+\t\tthen\n+\t\t\techo \"\" > \"$GIT_DIR/BISECT_OLDNEWMODE\"\n+\t\tfi\n \tfi &&\n \techo \"git bisect start$orig_args\" >>\"$GIT_DIR/BISECT_LOG\" || exit\n \t#\n@@ -416,6 +420,7 @@ bisect_clean_state() {\n \trm -f \"$GIT_DIR/BISECT_NAMES\" &&\n \trm -f \"$GIT_DIR/BISECT_RUN\" &&\n \trm -f \"$GIT_DIR/BISECT_TERMS\" &&\n+\trm -f \"$GIT_DIR/BISECT_OLDNEWMODE\" &&\n \t# Cleanup head-name if it got left by an old version of git-bisect\n \trm -f \"$GIT_DIR/head-name\" &&\n \tgit update-ref -d --no-deref BISECT_HEAD &&\n@@ -544,7 +549,8 @@ check_and_set_terms () {\n \t\t\tif test ! -s \"$GIT_DIR/BISECT_TERMS\"\n \t\t\tthen\n \t\t\t\techo \"new\" >\"$GIT_DIR/BISECT_TERMS\" &&\n-\t\t\t\techo \"old\" >>\"$GIT_DIR/BISECT_TERMS\"\n+\t\t\t\techo \"old\" >>\"$GIT_DIR/BISECT_TERMS\" &&\n+\t\t\t\techo \"\" > \"$GIT_DIR/BISECT_OLDNEWMODE\"\n \t\t\tfi\n \t\t\tBISECT_BAD=\"new\"\n \t\t\tBISECT_GOOD=\"old\" ;;\n-- \n1.7.1\n"},{"id":"263034","messageId":"1433522061-14532-2-git-send-email-stuberl@ensimag.grenoble-inp.fr","threadId":"39533","inReplyTo":"1433522061-14532-1-git-send-email-stuberl@ensimag.grenoble-inp.fr","subject":"[PATCH 2/2] Fix git rev-list --bisect and git bisect visualize when the bisection is done in old/new mode.","fromName":"Louis Stuber","fromEmail":"stuberl@ensimag.grenoble-inp.fr","sentAt":"2015-06-05T16:34:21Z","receivedAt":"2015-06-05T16:34:21Z","isPatch":true,"sender":{"key":"stuberl@ensimag.grenoble-inp.fr","avatar":null},"body":"\nSigned-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>\nSigned-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>\n---\n revision.c |   15 +++++++++++++--\n 1 files changed, 13 insertions(+), 2 deletions(-)\n\ndiff --git a/revision.c b/revision.c\nindex 7ddbaa0..b631596 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -2075,12 +2075,23 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,\n \n static int for_each_bad_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data)\n {\n-\treturn for_each_ref_in_submodule(submodule, \"refs/bisect/bad\", fn, cb_data);\n+\t/*\n+\t * if BISECT_OLDNEWMODE exists, this is an old/new bisect and the path is different\n+\t */\n+\tstruct stat st;\n+\tif (stat(git_path(\"BISECT_OLDNEWMODE\"), &st))\n+\t\treturn for_each_ref_in_submodule(submodule, \"refs/bisect/bad\", fn, cb_data);\n+\telse\n+\t\treturn for_each_ref_in_submodule(submodule, \"refs/bisect/new\", fn, cb_data);\n }\n \n static int for_each_good_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data)\n {\n-\treturn for_each_ref_in_submodule(submodule, \"refs/bisect/good\", fn, cb_data);\n+\tstruct stat st;\n+\tif (stat(git_path(\"BISECT_OLDNEWMODE\"), &st))\n+\t\treturn for_each_ref_in_submodule(submodule, \"refs/bisect/good\", fn, cb_data);\n+\telse\n+\t\treturn for_each_ref_in_submodule(submodule, \"refs/bisect/old\", fn, cb_data);\n }\n \n static int handle_revision_pseudo_opt(const char *submodule,\n-- \n1.7.1\n"},{"id":"263066","messageId":"CAPig+cQnrKEx_=WHw5gjA9SVtDObXWOJ3augZbhvNUuD8o19aA@mail.gmail.com","threadId":"39533","inReplyTo":"1433522061-14532-1-git-send-email-stuberl@ensimag.grenoble-inp.fr","subject":"Re: [PATCH 1/2] git-bisect.sh : create a file if the bisection is in old/new mode, named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program without having to read BISECT_TERMS. This will have to be changed in further versions if new terms are introduced.","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-06-05T20:03:15Z","receivedAt":"2015-06-05T20:03:15Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 5, 2015 at 12:34 PM, Louis Stuber\n<stuberl@ensimag.grenoble-inp.fr> wrote:\n> git-bisect.sh : create a file if the bisection is in old/new mode,\n> named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the\n> program without having to read BISECT_TERMS. This will have to be\n> changed in further versions if new terms are introduced.\n\nDocumentation/SubmittingPatches contains instructions for how to write\na good commit message. The first line should be a very brief\nhigh-level overview of the change, followed by a blank line, followed\nby one or more paragraphs justifying and explaining the change. Also,\nwrap the commit message to 70-72 columns.\n\nThis commit message doesn't do a very good job of explaining the\nproblem this change is trying to solve or justifying why this solution\nis preferable. Justification is particularly important considering the\nominous-sounding final sentence of the commit message (which itself\nseems to imply that this is not a very good change).\n\n> Signed-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>\n> Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>\n> ---\n> diff --git a/git-bisect.sh b/git-bisect.sh\n> index 109bd65..d3d19cb 100644\n> --- a/git-bisect.sh\n> +++ b/git-bisect.sh\n> @@ -183,6 +183,10 @@ bisect_start() {\n>         then\n>                 echo \"$BISECT_BAD\" >\"$GIT_DIR/BISECT_TERMS\" &&\n>                 echo \"$BISECT_GOOD\" >>\"$GIT_DIR/BISECT_TERMS\"\n> +               if test \"$BISECT_BAD\" = \"new\"\n\nNit: Unnecessary quotes around \"new\" make the code a bit more noisy,\nthus slightly more difficult to read.\n\n> +               then\n> +                       echo \"\" > \"$GIT_DIR/BISECT_OLDNEWMODE\"\n\nStyle: Drop space after redirection operator.\n\nIf only the file's existence is important, but not its content, then\nyou could phrase this more concisely without the 'echo'. Just use the\nredirection operator without any command in front of it: >\"$somefile\"\n\nSame comments apply below.\n\n> +               fi\n>         fi &&\n>         echo \"git bisect start$orig_args\" >>\"$GIT_DIR/BISECT_LOG\" || exit\n>         #\n> @@ -416,6 +420,7 @@ bisect_clean_state() {\n>         rm -f \"$GIT_DIR/BISECT_NAMES\" &&\n>         rm -f \"$GIT_DIR/BISECT_RUN\" &&\n>         rm -f \"$GIT_DIR/BISECT_TERMS\" &&\n> +       rm -f \"$GIT_DIR/BISECT_OLDNEWMODE\" &&\n>         # Cleanup head-name if it got left by an old version of git-bisect\n>         rm -f \"$GIT_DIR/head-name\" &&\n>         git update-ref -d --no-deref BISECT_HEAD &&\n> @@ -544,7 +549,8 @@ check_and_set_terms () {\n>                         if test ! -s \"$GIT_DIR/BISECT_TERMS\"\n>                         then\n>                                 echo \"new\" >\"$GIT_DIR/BISECT_TERMS\" &&\n> -                               echo \"old\" >>\"$GIT_DIR/BISECT_TERMS\"\n> +                               echo \"old\" >>\"$GIT_DIR/BISECT_TERMS\" &&\n> +                               echo \"\" > \"$GIT_DIR/BISECT_OLDNEWMODE\"\n>                         fi\n>                         BISECT_BAD=\"new\"\n>                         BISECT_GOOD=\"old\" ;;\n> --\n> 1.7.1\n"},{"id":"263069","messageId":"CAPig+cQ0W_Jw-1b+ghX6N9NYPfb_4KmDnLyCE=SEPAXFrP+egA@mail.gmail.com","threadId":"39533","inReplyTo":"1433522061-14532-2-git-send-email-stuberl@ensimag.grenoble-inp.fr","subject":"Re: [PATCH 2/2] Fix git rev-list --bisect and git bisect visualize when the bisection is done in old/new mode.","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-06-05T20:24:29Z","receivedAt":"2015-06-05T20:24:29Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 5, 2015 at 12:34 PM, Louis Stuber\n<stuberl@ensimag.grenoble-inp.fr> wrote:\n> Fix git rev-list --bisect and git bisect visualize when the bisection\n> is done in old/new mode.\n\nSee my review of patch 1/2 regarding writing a good commit message. In\nparticular, explain what is broken about \"git rev-list --bisect\" and\n\"git bisect visualize\" so that the reader can understand what this\npatch is actually fixing.\n\n> Signed-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>\n> Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>\n> ---\n> diff --git a/revision.c b/revision.c\n> index 7ddbaa0..b631596 100644\n> --- a/revision.c\n> +++ b/revision.c\n> @@ -2075,12 +2075,23 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,\n>\n>  static int for_each_bad_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data)\n>  {\n> -       return for_each_ref_in_submodule(submodule, \"refs/bisect/bad\", fn, cb_data);\n> +       /*\n> +        * if BISECT_OLDNEWMODE exists, this is an old/new bisect and the path is different\n> +        */\n\nComments which merely repeat what the code itself already clearly says\ndon't add value, and are thus noise which impede comprehension by\ndistracting the reader from digesting the underlying logic flow.\n\n> +       struct stat st;\n> +       if (stat(git_path(\"BISECT_OLDNEWMODE\"), &st))\n> +               return for_each_ref_in_submodule(submodule, \"refs/bisect/bad\", fn, cb_data);\n> +       else\n> +               return for_each_ref_in_submodule(submodule, \"refs/bisect/new\", fn, cb_data);\n\nSince the two for_each_ref_in_submodule() calls are identical except\nfor the second argument, the more natural and easier to comprehend way\nto phrase this would be be to assign \"refs/bisect/bad\" or\n\"refs/bisect/new\" to a variable, and then have just a single\ninvocation of for_each_ref_in_submodule() which uses that variable as\nits second argument.\n\nStepping back a moment: My reading of these two patches is that\nBISECT_OLDNEWMODE is introduced as a simple way to detect if \"old/new\"\nmode is being used rather than gleaning that knowledge from the\nexisting BISECT_TERMS file. Is that correct?\n\nIf so, then these changes are likely going in the wrong direction. The\nominous final sentence of the commit message of patch 1/2 is already a\ngood clue that this approach won't scale well. Further, the approach\ntaken here undesirably emphasizes ease of implementation and its\nattendant fragility over well thought out design.\n\n>  }\n>\n>  static int for_each_good_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data)\n>  {\n> -       return for_each_ref_in_submodule(submodule, \"refs/bisect/good\", fn, cb_data);\n> +       struct stat st;\n> +       if (stat(git_path(\"BISECT_OLDNEWMODE\"), &st))\n> +               return for_each_ref_in_submodule(submodule, \"refs/bisect/good\", fn, cb_data);\n> +       else\n> +               return for_each_ref_in_submodule(submodule, \"refs/bisect/old\", fn, cb_data);\n>  }\n>\n>  static int handle_revision_pseudo_opt(const char *submodule,\n> --\n> 1.7.1\n"},{"id":"263070","messageId":"CAP8UFD1OSSxfQOLggRv-VjE-8U=Vg7X5oe_UeFi4_yqOfXvgPA@mail.gmail.com","threadId":"39533","inReplyTo":"1433522061-14532-1-git-send-email-stuberl@ensimag.grenoble-inp.fr","subject":"Re: [PATCH 1/2] git-bisect.sh : create a file if the bisection is in old/new mode, named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program without having to read BISECT_TERMS. This will have to be changed in further versions if new terms are introduced.","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2015-06-05T20:24:48Z","receivedAt":"2015-06-05T20:24:48Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Fri, Jun 5, 2015 at 6:34 PM, Louis Stuber\n<stuberl@ensimag.grenoble-inp.fr> wrote:\n>\n> Signed-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>\n> Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>\n> ---\n\nIt looks like this patch applies on top of the bisect old/new series\nposted by Antoine.\nThis should be stated somewhere.\n\n>  git-bisect.sh |    8 +++++++-\n>  1 files changed, 7 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-bisect.sh b/git-bisect.sh\n> index 109bd65..d3d19cb 100644\n> --- a/git-bisect.sh\n> +++ b/git-bisect.sh\n> @@ -183,6 +183,10 @@ bisect_start() {\n>         then\n>                 echo \"$BISECT_BAD\" >\"$GIT_DIR/BISECT_TERMS\" &&\n>                 echo \"$BISECT_GOOD\" >>\"$GIT_DIR/BISECT_TERMS\"\n> +               if test \"$BISECT_BAD\" = \"new\"\n> +               then\n> +                       echo \"\" > \"$GIT_DIR/BISECT_OLDNEWMODE\"\n> +               fi\n\nI am not sure it's worth it to have both BISECT_TERMS and BISECT_OLDNEWMODE.\n\nAlso please note that I suggested to Antoine that the BISECT_BAD and\nBISECT_GOOD variables be renamed to something else, like I already did\nin some C files.\n"},{"id":"263158","messageId":"59937429.257594.1433703975898.JavaMail.zimbra@ensimag.grenoble-inp.fr","threadId":"39533","inReplyTo":"1179544255.257552.1433703835857.JavaMail.zimbra@ensimag.grenoble-inp.fr","subject":"Re: [PATCH 1/2] git-bisect.sh : create a file if the bisection is in old/new mode, named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program without having to read BISECT_TERMS. This will have to be changed in further versions if new terms are introduced.","fromName":"Louis-Alexandre Stuber","fromEmail":"stuberl@ensimag.grenoble-inp.fr","sentAt":"2015-06-07T19:06:15Z","receivedAt":"2015-06-07T19:06:15Z","isPatch":true,"sender":{"key":"stuberl@ensimag.grenoble-inp.fr","avatar":null},"body":"Thank you for the feedback. We are trying to apply all of your suggestions, but we would prefer to rebase the history before doing some of them (like renaming variables). \n\nAbout the BISECT_OLDNEWMODE file: The current implementation changes almost nothing to revision.c. We thought it was better, even if it needs a new file. The code for bisect uses BISECT_TERMS because 3 states are possible: 'bad/good mode', 'old/new mode', or 'no bisection started' (if BISECT_TERMS doesn't exist). But the other files (like revision.c) don't need all these informations, so we thought it would be good to check if a file exists instead of reusing BISECT_TERMS, which would require reading its content.\n"},{"id":"263203","messageId":"vpq616yctf3.fsf@anie.imag.fr","threadId":"39533","inReplyTo":"CAPig+cQnrKEx_=WHw5gjA9SVtDObXWOJ3augZbhvNUuD8o19aA@mail.gmail.com","subject":"Re: [PATCH 1/2] git-bisect.sh : create a file if the bisection is in old/new mode, named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program without having to read BISECT_TERMS. This will have to be changed in further versions if new terms are introduced.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-08T11:48:32Z","receivedAt":"2015-06-08T11:48:32Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> On Fri, Jun 5, 2015 at 12:34 PM, Louis Stuber\n> <stuberl@ensimag.grenoble-inp.fr> wrote:\n>> git-bisect.sh :\n\nNo space before : in english.\n\n>> create a file if the bisection is in old/new mode, named\n>> \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program\n>> without having to read BISECT_TERMS. This will have to be changed in\n>> further versions if new terms are introduced.\n>\n> Documentation/SubmittingPatches contains instructions for how to write\n> a good commit message.\n\nFor french-speaking people, and Ensimag students in particular, I'd add\n\n  http://ensiwiki.ensimag.fr/index.php/%C3%89crire_de_bons_messages_de_commit_avec_Git\n\n> Also, wrap the commit message to 70-72 columns.\n\nAs much as possible, the summary line should even be shorter (so that\n\"git log --oneline\" fits on a 80-chars terminal).\n\n> This commit message doesn't do a very good job of explaining the\n> problem this change is trying to solve or justifying why this solution\n> is preferable.\n\nActually, the commit message explains one reason why this is not a good\nsolution: the idea of having $GIT_DIR/BISECT_TERMS was to keep the\nsolution generic.\n\nHad the initial codebase been better factored, this patch series would\nhave been really trivial, but we hardcoded \"good\" and \"bad\" in many\nplaces, and now changing it is hard. Introducing BISECT_TERMS is a step\nforward, it avoids hardcoding the terms here and there in the code.\nTo me, introducing BISECT_OLDNEWMODE is a step backward, it's one more\nplace where we hardcode the terms.\n\n> Justification is particularly important considering the\n> ominous-sounding final sentence of the commit message (which itself\n> seems to imply that this is not a very good change).\n\nAh, indeed, we're saying the same thing.\n\n>> -                               echo \"old\" >>\"$GIT_DIR/BISECT_TERMS\"\n>> +                               echo \"old\" >>\"$GIT_DIR/BISECT_TERMS\" &&\n>> +                               echo \"\" > \"$GIT_DIR/BISECT_OLDNEWMODE\"\n\nNo space after > (noted by Eric elsewhere)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"263204","messageId":"vpqvbeybejy.fsf@anie.imag.fr","threadId":"39533","inReplyTo":"1179544255.257552.1433703835857.JavaMail.zimbra@ensimag.grenoble-inp.fr","subject":"Re: [PATCH 1/2] git-bisect.sh : create a file if the bisection is in old/new mode, named \"BISECT_OLDNEWMODE\", so it can easily be seen outside the program without having to read BISECT_TERMS. This will have to be changed in further versions if new terms are introduced.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-08T11:54:57Z","receivedAt":"2015-06-08T11:54:57Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Please, don't top-post on this list.\n\nLouis-Alexandre Stuber <stuberl@ensimag.grenoble-inp.fr> writes:\n\n> Thank you for the feedback. We are trying to apply all of your suggestions, but we would prefer to rebase the history before doing some of them (like renaming variables).\n>\n> About the BISECT_OLDNEWMODE file: The current implementation changes almost nothing to revision.c. We thought it was better, even if it needs a new file. The code for bisect uses BISECT_TERMS because 3 states are\n> possible: 'bad/good mode', 'old/new mode', or 'no bisection started'\n> (if BISECT_TERMS doesn't exist).\n\nI don't think it's the main reason. The point is to make the code\ngeneric: once the bisection has started and the terms are chosen, the\npossible states for a commit are not really bad/good or old/new, but\n'first line in BISECT_TERMS/second line in BISECT_TERMS'.\n\n> But the other files (like revision.c) don't need all these\n> informations, so we thought it would be good to check if a file exists\n> instead of reusing BISECT_TERMS, which would require reading its\n> content.\n>\n> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n> De: \"Christian Couder\" <christian.couder@gmail.com>\n> ...\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}