{"thread":{"id":"10280","subject":"[PATCH 6/7] Bisect: factorise \"bisect_{bad,good,dunno}\" into \"bisect_state\".","startedAt":"2007-10-14T12:30:03Z","lastAt":"2007-10-16T11:20:47Z","messageCount":6,"participants":["Christian Couder","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"55709","messageId":"20071014143003.23ae649f.chriscool@tuxfamily.org","threadId":"10280","inReplyTo":null,"subject":"[PATCH 6/7] Bisect: factorise \"bisect_{bad,good,dunno}\" into \"bisect_state\".","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-10-14T12:30:03Z","receivedAt":"2007-10-14T12:30:03Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n git-bisect.sh |   80 +++++++++++++++++++++-----------------------------------\n 1 files changed, 30 insertions(+), 50 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex e12125f..6a5ec5b 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -134,47 +134,33 @@ bisect_write() {\n \ttest -z \"$nolog\" && echo \"git-bisect $state $rev\" >>\"$GIT_DIR/BISECT_LOG\"\n }\n \n-bisect_bad() {\n+bisect_state() {\n \tbisect_autostart\n-\tcase \"$#\" in\n-\t0)\n-\t\trev=$(git rev-parse --verify HEAD) ;;\n-\t1)\n-\t\trev=$(git rev-parse --verify \"$1^{commit}\") ;;\n+\tstate=$1\n+\tcase \"$#,$state\" in\n+\t0,*)\n+\t\tdie \"Please call 'bisect_state' with at least one argument.\" ;;\n+\t1,bad|1,good|1,dunno)\n+\t\trev=$(git rev-parse --verify HEAD) ||\n+\t\t\tdie \"Bad rev input: HEAD\"\n+\t\tbisect_write \"$state\" \"$rev\" ;;\n+\t2,bad)\n+\t\trev=$(git rev-parse --verify \"$2^{commit}\") ||\n+\t\t\tdie \"Bad rev input: $2\"\n+\t\tbisect_write \"$state\" \"$rev\" ;;\n+\t*,good|*,dunno)\n+\t\tshift\n+\t\trevs=$(git rev-parse --revs-only --no-flags \"$@\") &&\n+\t\t\ttest '' != \"$revs\" || die \"Bad rev input: $@\"\n+\t\tfor rev in $revs\n+\t\tdo\n+\t\t\trev=$(git rev-parse --verify \"$rev^{commit}\") ||\n+\t\t\t\tdie \"Bad rev commit: $rev^{commit}\"\n+\t\t\tbisect_write \"$state\" \"$rev\"\n+\t\tdone ;;\n \t*)\n \t\tusage ;;\n-\tesac || exit\n-\tbisect_write 'bad' \"$rev\"\n-\tbisect_auto_next\n-}\n-\n-bisect_good() {\n-\tbisect_autostart\n-\tcase \"$#\" in\n-\t0)    revs=$(git rev-parse --verify HEAD) || exit ;;\n-\t*)    revs=$(git rev-parse --revs-only --no-flags \"$@\") &&\n-\t\ttest '' != \"$revs\" || die \"Bad rev input: $@\" ;;\n \tesac\n-\tfor rev in $revs\n-\tdo\n-\t\trev=$(git rev-parse --verify \"$rev^{commit}\") || exit\n-\t\tbisect_write 'good' \"$rev\"\n-\tdone\n-\tbisect_auto_next\n-}\n-\n-bisect_dunno() {\n-\tbisect_autostart\n-\tcase \"$#\" in\n-\t0)    revs=$(git rev-parse --verify HEAD) || exit ;;\n-\t*)    revs=$(git rev-parse --revs-only --no-flags \"$@\") &&\n-\t\ttest '' != \"$revs\" || die \"Bad rev input: $@\" ;;\n-\tesac\n-\tfor rev in $revs\n-\tdo\n-\t\trev=$(git rev-parse --verify \"$rev^{commit}\") || exit\n-\t\tbisect_write 'dunno' \"$rev\"\n-\tdone\n \tbisect_auto_next\n }\n \n@@ -404,17 +390,15 @@ bisect_run () {\n \t  exit $res\n       fi\n \n-      # Use \"bisect_good\" or \"bisect_bad\"\n-      # depending on run success or failure.\n+      # Find current state depending on run success or failure.\n       if [ $res -gt 0 ]; then\n-\t  next_bisect='bisect_bad'\n+\t  state='bad'\n       else\n-\t  next_bisect='bisect_good'\n+\t  state='good'\n       fi\n \n-      # We have to use a subshell because bisect_good or\n-      # bisect_bad functions can exit.\n-      ( $next_bisect > \"$GIT_DIR/BISECT_RUN\" )\n+      # We have to use a subshell because \"bisect_state\" can exit.\n+      ( bisect_state $state > \"$GIT_DIR/BISECT_RUN\" )\n       res=$?\n \n       cat \"$GIT_DIR/BISECT_RUN\"\n@@ -443,12 +427,8 @@ case \"$#\" in\n     case \"$cmd\" in\n     start)\n         bisect_start \"$@\" ;;\n-    bad)\n-        bisect_bad \"$@\" ;;\n-    good)\n-        bisect_good \"$@\" ;;\n-    dunno)\n-        bisect_dunno \"$@\" ;;\n+    bad|good|dunno)\n+        bisect_state \"$cmd\" \"$@\" ;;\n     next)\n         # Not sure we want \"next\" at the UI level anymore.\n         bisect_next \"$@\" ;;\n-- \n1.5.3.4.213.g68ad5\n"},{"id":"55729","messageId":"Pine.LNX.4.64.0710141710230.25221@racer.site","threadId":"10280","inReplyTo":"20071014143003.23ae649f.chriscool@tuxfamily.org","subject":"Re: [PATCH 6/7] Bisect: factorise \"bisect_{bad,good,dunno}\" into \"bisect_state\".","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-14T16:15:09Z","receivedAt":"2007-10-14T16:15:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 14 Oct 2007, Christian Couder wrote:\n\n> -bisect_bad() {\n> +bisect_state() {\n>  \tbisect_autostart\n> -\tcase \"$#\" in\n> -\t0)\n> -\t\trev=$(git rev-parse --verify HEAD) ;;\n> -\t1)\n> -\t\trev=$(git rev-parse --verify \"$1^{commit}\") ;;\n> +\tstate=$1\n> +\tcase \"$#,$state\" in\n> +\t0,*)\n> +\t\tdie \"Please call 'bisect_state' with at least one argument.\" ;;\n> +\t1,bad|1,good|1,dunno)\n> +\t\trev=$(git rev-parse --verify HEAD) ||\n> +\t\t\tdie \"Bad rev input: HEAD\"\n> +\t\tbisect_write \"$state\" \"$rev\" ;;\n> +\t2,bad)\n> +\t\trev=$(git rev-parse --verify \"$2^{commit}\") ||\n> +\t\t\tdie \"Bad rev input: $2\"\n> +\t\tbisect_write \"$state\" \"$rev\" ;;\n\nReally?  As far as I see, \"2,bad\" is an error in the current bisect.\n\n> @@ -404,17 +390,15 @@ bisect_run () {\n>  \t  exit $res\n>        fi\n>  \n> -      # Use \"bisect_good\" or \"bisect_bad\"\n> -      # depending on run success or failure.\n> +      # Find current state depending on run success or failure.\n>        if [ $res -gt 0 ]; then\n> -\t  next_bisect='bisect_bad'\n> +\t  state='bad'\n>        else\n> -\t  next_bisect='bisect_good'\n> +\t  state='good'\n>        fi\n\nMaybe it is time to have a special exit status for \"dunno\"?  But this is \nnot something to fix in your patch, just an idea for a future patch.\n\nCiao,\nDscho\n"},{"id":"55806","messageId":"200710150542.17667.chriscool@tuxfamily.org","threadId":"10280","inReplyTo":"Pine.LNX.4.64.0710141710230.25221@racer.site","subject":"Re: [PATCH 6/7] Bisect: factorise \"bisect_{bad,good,dunno}\" into \"bisect_state\".","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-10-15T03:42:17Z","receivedAt":"2007-10-15T03:42:17Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le dimanche 14 octobre 2007, Johannes Schindelin a écrit :\n> Hi,\n>\n> On Sun, 14 Oct 2007, Christian Couder wrote:\n> > -bisect_bad() {\n> > +bisect_state() {\n> >  \tbisect_autostart\n> > -\tcase \"$#\" in\n> > -\t0)\n> > -\t\trev=$(git rev-parse --verify HEAD) ;;\n> > -\t1)\n> > -\t\trev=$(git rev-parse --verify \"$1^{commit}\") ;;\n> > +\tstate=$1\n> > +\tcase \"$#,$state\" in\n> > +\t0,*)\n> > +\t\tdie \"Please call 'bisect_state' with at least one argument.\" ;;\n> > +\t1,bad|1,good|1,dunno)\n> > +\t\trev=$(git rev-parse --verify HEAD) ||\n> > +\t\t\tdie \"Bad rev input: HEAD\"\n> > +\t\tbisect_write \"$state\" \"$rev\" ;;\n> > +\t2,bad)\n> > +\t\trev=$(git rev-parse --verify \"$2^{commit}\") ||\n> > +\t\t\tdie \"Bad rev input: $2\"\n> > +\t\tbisect_write \"$state\" \"$rev\" ;;\n>\n> Really?  As far as I see, \"2,bad\" is an error in the current bisect.\n\nBut the new \"bisect_state\" takes one more argument, because the first one \nmust be \"good\" \"bad\" or \"dunno\".\n\nSo when there is only one argument HEAD is used, and when there are 2 \narguments, $2 is used as the good|bad|dunno rev. \n\n> > @@ -404,17 +390,15 @@ bisect_run () {\n> >  \t  exit $res\n> >        fi\n> >\n> > -      # Use \"bisect_good\" or \"bisect_bad\"\n> > -      # depending on run success or failure.\n> > +      # Find current state depending on run success or failure.\n> >        if [ $res -gt 0 ]; then\n> > -\t  next_bisect='bisect_bad'\n> > +\t  state='bad'\n> >        else\n> > -\t  next_bisect='bisect_good'\n> > +\t  state='good'\n> >        fi\n>\n> Maybe it is time to have a special exit status for \"dunno\"?  But this is\n> not something to fix in your patch, just an idea for a future patch.\n\nYes, I will think about it.\n\nThanks,\nChristian.\n"},{"id":"55859","messageId":"Pine.LNX.4.64.0710151338000.25221@racer.site","threadId":"10280","inReplyTo":"200710150542.17667.chriscool@tuxfamily.org","subject":"Re: [PATCH 6/7] Bisect: factorise \"bisect_{bad,good,dunno}\" into \"bisect_state\".","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-15T12:38:53Z","receivedAt":"2007-10-15T12:38:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 15 Oct 2007, Christian Couder wrote:\n\n> Le dimanche 14 octobre 2007, Johannes Schindelin a ?crit :\n>\n> > On Sun, 14 Oct 2007, Christian Couder wrote:\n> > > -bisect_bad() {\n> > > +bisect_state() {\n> > >  \tbisect_autostart\n> > > -\tcase \"$#\" in\n> > > -\t0)\n> > > -\t\trev=$(git rev-parse --verify HEAD) ;;\n> > > -\t1)\n> > > -\t\trev=$(git rev-parse --verify \"$1^{commit}\") ;;\n> > > +\tstate=$1\n> > > +\tcase \"$#,$state\" in\n> > > +\t0,*)\n> > > +\t\tdie \"Please call 'bisect_state' with at least one argument.\" ;;\n> > > +\t1,bad|1,good|1,dunno)\n> > > +\t\trev=$(git rev-parse --verify HEAD) ||\n> > > +\t\t\tdie \"Bad rev input: HEAD\"\n> > > +\t\tbisect_write \"$state\" \"$rev\" ;;\n> > > +\t2,bad)\n> > > +\t\trev=$(git rev-parse --verify \"$2^{commit}\") ||\n> > > +\t\t\tdie \"Bad rev input: $2\"\n> > > +\t\tbisect_write \"$state\" \"$rev\" ;;\n> >\n> > Really?  As far as I see, \"2,bad\" is an error in the current bisect.\n> \n> But the new \"bisect_state\" takes one more argument, because the first \n> one must be \"good\" \"bad\" or \"dunno\".\n> \n> So when there is only one argument HEAD is used, and when there are 2 \n> arguments, $2 is used as the good|bad|dunno rev.\n\nAh, that explains it!  But do you not need to do \"2,bad|2,good|2,dunno\" in \nthat case?  Or even better: \"2,*\"?\n\nThanks,\nDscho\n"},{"id":"55959","messageId":"200710160828.05137.chriscool@tuxfamily.org","threadId":"10280","inReplyTo":"Pine.LNX.4.64.0710151338000.25221@racer.site","subject":"Re: [PATCH 6/7] Bisect: factorise \"bisect_{bad,good,dunno}\" into \"bisect_state\".","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2007-10-16T06:28:04Z","receivedAt":"2007-10-16T06:28:04Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi Dscho,\n\nLe lundi 15 octobre 2007, Johannes Schindelin a écrit :\n> Hi,\n>\n> On Mon, 15 Oct 2007, Christian Couder wrote:\n> >\n> > But the new \"bisect_state\" takes one more argument, because the first\n> > one must be \"good\" \"bad\" or \"dunno\".\n> >\n> > So when there is only one argument HEAD is used, and when there are 2\n> > arguments, $2 is used as the good|bad|dunno rev.\n>\n> Ah, that explains it!  But do you not need to do \"2,bad|2,good|2,dunno\"\n> in that case?  Or even better: \"2,*\"?\n\nPerhaps it would be an improvement at least in speed for \"2,good\" \nor \"2,dunno\".\n\nI wanted to keep exactly the same processing as there was before, in case \nsomething like \"git bisect good v1.5.3.3..v1.5.3.4\" was supported. But it \nseems it doesn't work. I don't know if it's a bug or a feature.\n\nChristian.\n"},{"id":"56017","messageId":"Pine.LNX.4.64.0710161218260.25221@racer.site","threadId":"10280","inReplyTo":"200710160828.05137.chriscool@tuxfamily.org","subject":"Re: [PATCH 6/7] Bisect: factorise \"bisect_{bad,good,dunno}\" into \"bisect_state\".","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-16T11:20:47Z","receivedAt":"2007-10-16T11:20:47Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\n[finally, a technical argument on \"dunno\".  Maybe we really need \ngit-bikeshed@vger.kernel.org? ;-)]\n\nOn Tue, 16 Oct 2007, Christian Couder wrote:\n\n> Le lundi 15 octobre 2007, Johannes Schindelin a ?crit :\n> >\n> > On Mon, 15 Oct 2007, Christian Couder wrote:\n> > >\n> > > But the new \"bisect_state\" takes one more argument, because the first\n> > > one must be \"good\" \"bad\" or \"dunno\".\n> > >\n> > > So when there is only one argument HEAD is used, and when there are \n> > > 2 arguments, $2 is used as the good|bad|dunno rev.\n> >\n> > Ah, that explains it!  But do you not need to do \n> > \"2,bad|2,good|2,dunno\" in that case?  Or even better: \"2,*\"?\n> \n> Perhaps it would be an improvement at least in speed for \"2,good\" or \n> \"2,dunno\".\n\nI see: the later case catches them.  Colour me satisfied with your patch.\n\n> I wanted to keep exactly the same processing as there was before, in case \n> something like \"git bisect good v1.5.3.3..v1.5.3.4\" was supported. But it \n> seems it doesn't work. I don't know if it's a bug or a feature.\n\nI think v1.5.3.3..v1.5.3.4 expands to ^v1.5.3.3 v1.5.3.4, which might \nexplain what you are experiencing.\n\nOTOH \"git bisect good v1.5.3.3..v1.5.3.4\" does not make sense.  bisect \nassumes that all ancestors of a good commit are good, too.\n\nCiao,\nDscho\n"}]}