{"thread":{"id":"1702","subject":"Bisection visualization hint..","startedAt":"2005-08-30T17:29:39Z","lastAt":"2005-08-30T18:56:42Z","messageCount":7,"participants":["Linus Torvalds","Junio C Hamano","A Large Angry SCM"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"7952","messageId":"Pine.LNX.4.58.0508301026450.4293@g5.osdl.org","threadId":"1702","inReplyTo":null,"subject":"Bisection visualization hint..","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-30T17:29:39Z","receivedAt":"2005-08-30T17:29:39Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nI'm testing bisection to find a bug that causes my G5 to no longer boot, \nand during the process have found this command line very nice:\n\n\tgitk bisect/bad --not $(cd .git/refs ; ls bisect/good-*)\n\nit basically shows the state of bisection with the known bad commit as the \ntop, and cutting off all the good commits - so what you see are the \npotential buggy commits.\n\nBut it's not the nicest of command lines and depends on knowing how\nbisection works, so maybe we could make\n\n\tgit bisect visualize\n\ndo this for us?\n\n\t\tLinus\n"},{"id":"7953","messageId":"7vhdd7joz6.fsf@assigned-by-dhcp.cox.net","threadId":"1702","inReplyTo":"Pine.LNX.4.58.0508301026450.4293@g5.osdl.org","subject":"Re: Bisection visualization hint..","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-30T17:47:57Z","receivedAt":"2005-08-30T17:47:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> I'm testing bisection to find a bug that causes my G5 to no longer boot, \n> and during the process have found this command line very nice:\n>\n> \tgitk bisect/bad --not $(cd .git/refs ; ls bisect/good-*)\n>\n> it basically shows the state of bisection with the known bad commit as the \n> top, and cutting off all the good commits - so what you see are the \n> potential buggy commits.\n\n> But it's not the nicest of command lines and depends on knowing how\n> bisection works, so maybe we could make\n>\n> \tgit bisect visualize\n>\n> do this for us?\n\nWill do.\n\nAnother thing that might make sense is roll it also into gitk, a\nnew command from \"File\" menu to cause it to re-read not just ref\nvalues but the rev-list itself out of that particular rev-list\ncommand (and add any other common patterns as we discover them).\n"},{"id":"7954","messageId":"43149F79.4020809@gmail.com","threadId":"1702","inReplyTo":"7vhdd7joz6.fsf@assigned-by-dhcp.cox.net","subject":"Re: Bisection visualization hint..","fromName":"A Large Angry SCM","fromEmail":"gitzilla@gmail.com","sentAt":"2005-08-30T18:03:37Z","receivedAt":"2005-08-30T18:03:37Z","isPatch":false,"sender":{"key":"gitzilla@gmail.com","avatar":"https://gravatar.com/avatar/354625c442439908ff3dd99757dee330e29e9df7847472384faf7a00add247fb?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Linus Torvalds <torvalds@osdl.org> writes:\n> \n>>I'm testing bisection to find a bug that causes my G5 to no longer boot, \n>>and during the process have found this command line very nice:\n>>\n>>\tgitk bisect/bad --not $(cd .git/refs ; ls bisect/good-*)\n>>\n>>it basically shows the state of bisection with the known bad commit as the \n>>top, and cutting off all the good commits - so what you see are the \n>>potential buggy commits.\n> \n>>But it's not the nicest of command lines and depends on knowing how\n>>bisection works, so maybe we could make\n>>\n>>\tgit bisect visualize\n>>\n>>do this for us?\n> \n> Will do.\n> \n> Another thing that might make sense is roll it also into gitk, a\n> new command from \"File\" menu to cause it to re-read not just ref\n> values but the rev-list itself out of that particular rev-list\n> command (and add any other common patterns as we discover them).\n\nUnless gitk will always be part of git, this is better off as a gitk \nfeature or gitk helper script. IE. it belongs in the gitk namespace, not \nthe git namespace.\n\nThat said, a wrapper for \"git show-branch\" (git show-bisect?) would be \nnice also.\n"},{"id":"7955","messageId":"Pine.LNX.4.58.0508301038340.4426@g5.osdl.org","threadId":"1702","inReplyTo":"Pine.LNX.4.58.0508301026450.4293@g5.osdl.org","subject":"Fix bisection terminating condition","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-30T18:04:39Z","receivedAt":"2005-08-30T18:04:39Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nWhen testing bisection and using gitk to visualize the result, it was \nobvious that the termination condition was broken.\n\nWe know what the bad entry is only when the bisection ends up telling us \nto test the known-bad entry again.\n\nAlso, add a safety net: if somebody marks as good something that includes \nthe known-bad point, we now notice and complain, instead of writing an \nempty revision to the new bisection branch.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/git-bisect-script b/git-bisect-script\n--- a/git-bisect-script\n+++ b/git-bisect-script\n@@ -105,12 +105,16 @@ bisect_next() {\n \tgood=$(git-rev-parse --sq --revs-only --not \\\n \t\t$(cd \"$GIT_DIR\" && ls refs/bisect/good-*)) &&\n \trev=$(eval \"git-rev-list --bisect $good $bad\") || exit\n-\tnr=$(eval \"git-rev-list $rev $good\" | wc -l) || exit\n-\tif [ \"$nr\" -le \"1\" ]; then\n+\tif [ -z \"$rev\" ]; then\n+\t    echo \"$bad was both good and bad\"\n+\t    exit 1\n+\tfi\n+\tif [ \"$rev\" = \"$bad\" ]; then\n \t    echo \"$rev is first bad commit\"\n \t    git-diff-tree --pretty $rev\n \t    exit 0\n \tfi\n+\tnr=$(eval \"git-rev-list $rev $good\" | wc -l) || exit\n \techo \"Bisecting: $nr revisions left to test after this\"\n \techo \"$rev\" > \"$GIT_DIR/refs/heads/new-bisect\"\n \tgit checkout new-bisect || exit\n"},{"id":"7956","messageId":"Pine.LNX.4.58.0508301116100.4237@g5.osdl.org","threadId":"1702","inReplyTo":"43149F79.4020809@gmail.com","subject":"Re: Bisection visualization hint..","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-30T18:17:55Z","receivedAt":"2005-08-30T18:17:55Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 30 Aug 2005, A Large Angry SCM wrote:\n> \n> Unless gitk will always be part of git, this is better off as a gitk \n> feature or gitk helper script. IE. it belongs in the gitk namespace, not \n> the git namespace.\n\nI really think that gitk is pretty fundamental. If for no other reason \nthan the big fact that it helps people understand what is going on. That's \nwhy it's mentioned in the tutorial - people who have only used something \nbroken like CVS will have a hard time visualizing what's going on, I \nsuspect, but with gitk it all looks simple.\n\n\t\tLinus\n"},{"id":"7957","messageId":"7v64tnjndb.fsf@assigned-by-dhcp.cox.net","threadId":"1702","inReplyTo":"Pine.LNX.4.58.0508301026450.4293@g5.osdl.org","subject":"[PATCH] 'git bisect visualize'","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-30T18:22:40Z","receivedAt":"2005-08-30T18:22:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus says:\n\n    I'm testing bisection to find a bug that causes my G5 to no longer boot,\n    and during the process have found this command line very nice:\n\n\t    gitk bisect/bad --not $(cd .git/refs ; ls bisect/good-*)\n\n    it basically shows the state of bisection with the known bad commit as the\n    top, and cutting off all the good commits - so what you see are the\n    potential buggy commits.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * I think turning the flow inside out and driving bisect from\n   gitk might make more sense, though.  You start 'Bisect...'\n   from the 'File' menu, click on one node and say 'good' or\n   'bad' from its pop-up menu,...\n\n git-bisect-script |   33 ++++++++++++++++++++++++++-------\n 1 files changed, 26 insertions(+), 7 deletions(-)\n\n0e0713a470e7bea760aa0bd7510ddc668fb8b744\ndiff --git a/git-bisect-script b/git-bisect-script\n--- a/git-bisect-script\n+++ b/git-bisect-script\n@@ -2,12 +2,13 @@\n . git-sh-setup-script || dir \"Not a git archive\"\n \n usage() {\n-    echo >&2 'usage: git bisect [start | bad | good | next | reset]\n+    echo >&2 'usage: git bisect [start|bad|good|next|reset|visualize]\n git bisect start\t\treset bisect state and start bisection.\n git bisect bad [<rev>]\t\tmark <rev> a known-bad revision.\n git bisect good [<rev>...]\tmark <rev>... known-good revisions.\n git bisect next\t\t\tfind next bisection to test and check it out.\n-git bisect reset [<branch>]\tfinish bisection search and go back to branch.'\n+git bisect reset [<branch>]\tfinish bisection search and go back to branch.\n+git bisect visualize\t\tshow the current state in gitk.'\n     exit 1\n }\n \n@@ -57,9 +58,15 @@ bisect_start() {\n \n bisect_bad() {\n \tbisect_autostart\n-        case \"$#\" in 0 | 1) ;; *) usage ;; esac\n-\trev=$(git-rev-parse --verify --default HEAD \"$@\") || exit\n-\techo \"$rev\" > \"$GIT_DIR/refs/bisect/bad\"\n+        case \"$#\" in\n+\t0)\n+\t\trev=$(git-rev-parse --verify HEAD) ;;\n+\t1)\n+\t\trev=$(git-rev-parse --verify \"$1\") ;;\n+\t*)\n+\t\tusage ;;\n+\tesac || exit\n+\techo \"$rev\" >\"$GIT_DIR/refs/bisect/bad\"\n \tbisect_auto_next\n }\n \n@@ -67,10 +74,12 @@ bisect_good() {\n \tbisect_autostart\n         case \"$#\" in\n \t0)    revs=$(git-rev-parse --verify HEAD) || exit ;;\n-\t*)    revs=$(git-rev-parse --revs-only --no-flags \"$@\") || exit ;;\n+\t*)    revs=$(git-rev-parse --revs-only --no-flags \"$@\") &&\n+\t      test '' != \"$revs\" || die \"Bad rev: $@\" ;;\n \tesac\n \tfor rev in $revs\n \tdo\n+\t    rev=$(git-rev-parse --verify $rev) || exit\n \t    echo \"$rev\" >\"$GIT_DIR/refs/bisect/good-$rev\"\n \tdone\n \tbisect_auto_next\n@@ -107,8 +116,11 @@ bisect_next() {\n \trev=$(eval \"git-rev-list --bisect $good $bad\") || exit\n \tnr=$(eval \"git-rev-list $rev $good\" | wc -l) || exit\n \tif [ \"$nr\" -le \"1\" ]; then\n+\t    if [ \"$rev\" = \"\" ]; then\n+\t\tdie \"Your input does not make sense.\"\n+\t    fi\n \t    echo \"$rev is first bad commit\"\n-\t    git-diff-tree --pretty $rev\n+\t    git-diff-tree --pretty \"$rev\"\n \t    exit 0\n \tfi\n \techo \"Bisecting: $nr revisions left to test after this\"\n@@ -118,6 +130,11 @@ bisect_next() {\n \tln -sf refs/heads/bisect \"$GIT_DIR/HEAD\"\n }\n \n+bisect_visualize() {\n+\tbisect_next_check fail\n+\tgitk bisect/bad --not `cd \"$GIT_DIR/refs\" && echo bisect/good-*`\n+}\n+\n bisect_reset() {\n \tcase \"$#\" in\n \t0) branch=master ;;\n@@ -150,6 +167,8 @@ case \"$#\" in\n     next)\n         # Not sure we want \"next\" at the UI level anymore.\n         bisect_next \"$@\" ;;\n+    visualize)\n+        bisect_visualize \"$@\" ;;\n     reset)\n         bisect_reset \"$@\" ;;\n     *)\n"},{"id":"7958","messageId":"7vy86ji785.fsf@assigned-by-dhcp.cox.net","threadId":"1702","inReplyTo":"Pine.LNX.4.58.0508301038340.4426@g5.osdl.org","subject":"Re: Fix bisection terminating condition","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-30T18:56:42Z","receivedAt":"2005-08-30T18:56:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> When testing bisection and using gitk to visualize the result, it was \n> obvious that the termination condition was broken.\n\nThanks.\n"}]}