{"thread":{"id":"28026","subject":"[PATCH 0/2] bisect: cleanup formatting of git-bisect.sh","startedAt":"2011-08-05T11:31:29Z","lastAt":"2011-08-06T03:40:27Z","messageCount":5,"participants":["Jon Seymour","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"172970","messageId":"1312543891-11079-1-git-send-email-jon.seymour@gmail.com","threadId":"28026","inReplyTo":null,"subject":"[PATCH 0/2] bisect: cleanup formatting of git-bisect.sh","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-05T11:31:29Z","receivedAt":"2011-08-05T11:31:29Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"This series is intended to be applied on top js/bisect-no-checkout.\n\nThe first patch ensures all leading whitespace is encoded with tabs, where possible.\n\nThe second patch replaces constructs of the form:\n\n\tif cond-statement; then\n\t\tthen-statement\n\tfi\n\nwith:\n\n\tif cond-statement\n\tthen\n\t\tthen-statement\n\tfi\t\n\t\n\nJon Seymour (2):\n  bisect: cleanup whitespace errors in git-bisect.sh.\n  bisect: replace \"; then\" with \"\\n<tab>*then\"\n\n git-bisect.sh |  283 +++++++++++++++++++++++++++++----------------------------\n 1 files changed, 146 insertions(+), 137 deletions(-)\n\n-- \n1.7.6.354.g7f57d\n"},{"id":"172971","messageId":"1312543891-11079-2-git-send-email-jon.seymour@gmail.com","threadId":"28026","inReplyTo":"1312543891-11079-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 1/2] bisect: cleanup whitespace errors in git-bisect.sh.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-05T11:31:30Z","receivedAt":"2011-08-05T11:31:30Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"All leading whitespace is now encoded with tabs.\n\nAfter this patch, the following is true:\n\n\tRAW=$(cat git-bisect.sh | md5sum) &&\n\tROUNDTRIP=$(cat git-bisect.sh | expand -i - | unexpand --first-only - | md5sum) &&\n\tLEADING=$(sed -n \"/^  */p\" < git-bisect.sh | wc -l) &&\n\ttest $RAW = $ROUNDTRIP &&\n\ttest $LEADING = 0 &&\n\ttest -z \"$(git diff -w HEAD~1 HEAD)\"\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-bisect.sh |  268 ++++++++++++++++++++++++++++----------------------------\n 1 files changed, 134 insertions(+), 134 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex b9c18dd..f5d9ede 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -2,27 +2,27 @@\n \n USAGE='[help|start|bad|good|skip|next|reset|visualize|replay|log|run]'\n LONG_USAGE='git bisect help\n-        print this long help message.\n+\tprint this long help message.\n git bisect start [--no-checkout] [<bad> [<good>...]] [--] [<pathspec>...]\n-        reset bisect state and start bisection.\n+\treset bisect state and start bisection.\n git bisect bad [<rev>]\n-        mark <rev> a known-bad revision.\n+\tmark <rev> a known-bad revision.\n git bisect good [<rev>...]\n-        mark <rev>... known-good revisions.\n+\tmark <rev>... known-good revisions.\n git bisect skip [(<rev>|<range>)...]\n-        mark <rev>... untestable revisions.\n+\tmark <rev>... untestable revisions.\n git bisect next\n-        find next bisection to test and check it out.\n+\tfind next bisection to test and check it out.\n git bisect reset [<commit>]\n-        finish bisection search and go back to commit.\n+\tfinish bisection search and go back to commit.\n git bisect visualize\n-        show bisect status in gitk.\n+\tshow bisect status in gitk.\n git bisect replay <logfile>\n-        replay bisection log.\n+\treplay bisection log.\n git bisect log\n-        show bisect log.\n+\tshow bisect log.\n git bisect run <cmd>...\n-        use <cmd>... to automatically bisect.\n+\tuse <cmd>... to automatically bisect.\n \n Please use \"git help bisect\" to get the full man page.'\n \n@@ -55,7 +55,7 @@ bisect_autostart() {\n \t\t\t# TRANSLATORS: Make sure to include [Y] and [n] in your\n \t\t\t# translation. The program will only accept English input\n \t\t\t# at this point.\n-\t    gettext \"Do you want me to do it for you [Y/n]? \" >&2\n+\t\t\tgettext \"Do you want me to do it for you [Y/n]? \" >&2\n \t\t\tread yesno\n \t\t\tcase \"$yesno\" in\n \t\t\t[Nn]*)\n@@ -74,38 +74,38 @@ bisect_start() {\n \t#\n \thas_double_dash=0\n \tfor arg; do\n-\t    case \"$arg\" in --) has_double_dash=1; break ;; esac\n+\t\tcase \"$arg\" in --) has_double_dash=1; break ;; esac\n \tdone\n \torig_args=$(git rev-parse --sq-quote \"$@\")\n \tbad_seen=0\n \teval=''\n \tmode=''\n \twhile [ $# -gt 0 ]; do\n-\t    arg=\"$1\"\n-\t    case \"$arg\" in\n-\t    --)\n-\t\tshift\n-\t\tbreak\n+\t\targ=\"$1\"\n+\t\tcase \"$arg\" in\n+\t\t--)\n+\t\t\tshift\n+\t\t\tbreak\n \t\t;;\n-\t    --no-checkout)\n-\t\tmode=--no-checkout\n-\t\tshift ;;\n-\t    --*)\n-\t\tdie \"$(eval_gettext \"unrecognised option: '\\$arg'\")\" ;;\n-\t    *)\n-\t\trev=$(git rev-parse -q --verify \"$arg^{commit}\") || {\n-\t\t    test $has_double_dash -eq 1 &&\n+\t\t--no-checkout)\n+\t\t\tmode=--no-checkout\n+\t\t\tshift ;;\n+\t\t--*)\n+\t\t\tdie \"$(eval_gettext \"unrecognised option: '\\$arg'\")\" ;;\n+\t\t*)\n+\t\t\trev=$(git rev-parse -q --verify \"$arg^{commit}\") || {\n+\t\t\t    test $has_double_dash -eq 1 &&\n \t\t\tdie \"$(eval_gettext \"'\\$arg' does not appear to be a valid revision\")\"\n-\t\t    break\n-\t\t}\n-\t\tcase $bad_seen in\n-\t\t0) state='bad' ; bad_seen=1 ;;\n-\t\t*) state='good' ;;\n+\t\t\t    break\n+\t\t\t}\n+\t\t\tcase $bad_seen in\n+\t\t\t0) state='bad' ; bad_seen=1 ;;\n+\t\t\t*) state='good' ;;\n+\t\t\tesac\n+\t\t\teval=\"$eval bisect_write '$state' '$rev' 'nolog' &&\"\n+\t\t\tshift\n+\t\t\t;;\n \t\tesac\n-\t\teval=\"$eval bisect_write '$state' '$rev' 'nolog' &&\"\n-\t\tshift\n-\t\t;;\n-\t    esac\n \tdone\n \n \t#\n@@ -207,18 +207,18 @@ check_expected_revs() {\n }\n \n bisect_skip() {\n-        all=''\n+\tall=''\n \tfor arg in \"$@\"\n \tdo\n-\t    case \"$arg\" in\n-            *..*)\n-\t\trevs=$(git rev-list \"$arg\") || die \"$(eval_gettext \"Bad rev input: \\$arg\")\" ;;\n-            *)\n-                revs=$(git rev-parse --sq-quote \"$arg\") ;;\n-\t    esac\n-            all=\"$all $revs\"\n-        done\n-        eval bisect_state 'skip' $all\n+\t\tcase \"$arg\" in\n+\t\t*..*)\n+\t\t\trevs=$(git rev-list \"$arg\") || die \"$(eval_gettext \"Bad rev input: \\$arg\")\" ;;\n+\t\t*)\n+\t\t\trevs=$(git rev-parse --sq-quote \"$arg\") ;;\n+\t\tesac\n+\t\tall=\"$all $revs\"\n+\tdone\n+\teval bisect_state 'skip' $all\n }\n \n bisect_state() {\n@@ -316,7 +316,7 @@ bisect_next() {\n \tgit bisect--helper --next-all $(test -f \"$GIT_DIR/BISECT_HEAD\" && echo --no-checkout)\n \tres=$?\n \n-        # Check if we should exit because bisection is finished\n+\t# Check if we should exit because bisection is finished\n \ttest $res -eq 10 && exit 0\n \n \t# Check for an error in the bisection process\n@@ -355,12 +355,12 @@ bisect_reset() {\n \tcase \"$#\" in\n \t0) branch=$(cat \"$GIT_DIR/BISECT_START\") ;;\n \t1) git rev-parse --quiet --verify \"$1^{commit}\" > /dev/null || {\n-\t       invalid=\"$1\"\n-\t       die \"$(eval_gettext \"'\\$invalid' is not a valid commit\")\"\n-\t   }\n-\t   branch=\"$1\" ;;\n+\t\t\tinvalid=\"$1\"\n+\t\t\tdie \"$(eval_gettext \"'\\$invalid' is not a valid commit\")\"\n+\t\t}\n+\t\tbranch=\"$1\" ;;\n \t*)\n-\t    usage ;;\n+\t\tusage ;;\n \tesac\n \tif ! test -f \"$GIT_DIR/BISECT_HEAD\"\n \tthen\n@@ -418,65 +418,65 @@ bisect_replay () {\n }\n \n bisect_run () {\n-    bisect_next_check fail\n-\n-    while true\n-    do\n-      command=\"$@\"\n-      eval_gettext \"running \\$command\"; echo\n-      \"$@\"\n-      res=$?\n-\n-      # Check for really bad run error.\n-      if [ $res -lt 0 -o $res -ge 128 ]; then\n-\t  (\n-\t    eval_gettext \"bisect run failed:\n+\tbisect_next_check fail\n+\n+\twhile true\n+\tdo\n+\t\tcommand=\"$@\"\n+\t\teval_gettext \"running \\$command\"; echo\n+\t\t\"$@\"\n+\t\tres=$?\n+\n+\t\t# Check for really bad run error.\n+\t\tif [ $res -lt 0 -o $res -ge 128 ]; then\n+\t\t\t(\n+\t\t\t\teval_gettext \"bisect run failed:\n exit code \\$res from '\\$command' is < 0 or >= 128\" &&\n-\t    echo\n-\t  ) >&2\n-\t  exit $res\n-      fi\n-\n-      # Find current state depending on run success or failure.\n-      # A special exit code of 125 means cannot test.\n-      if [ $res -eq 125 ]; then\n-\t  state='skip'\n-      elif [ $res -gt 0 ]; then\n-\t  state='bad'\n-      else\n-\t  state='good'\n-      fi\n-\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-\n-      if sane_grep \"first bad commit could be any of\" \"$GIT_DIR/BISECT_RUN\" \\\n-\t\t> /dev/null; then\n-\t  (\n-\t      gettext \"bisect run cannot continue any more\" &&\n-\t      echo\n-\t  ) >&2\n-\t  exit $res\n-      fi\n-\n-      if [ $res -ne 0 ]; then\n-\t  (\n-\t      eval_gettext \"bisect run failed:\n+\t\t\t\techo\n+\t\t\t) >&2\n+\t\t\texit $res\n+\t\tfi\n+\n+\t\t# Find current state depending on run success or failure.\n+\t\t# A special exit code of 125 means cannot test.\n+\t\tif [ $res -eq 125 ]; then\n+\t\t\tstate='skip'\n+\t\telif [ $res -gt 0 ]; then\n+\t\t\tstate='bad'\n+\t\telse\n+\t\t\tstate='good'\n+\t\tfi\n+\n+\t\t# We have to use a subshell because \"bisect_state\" can exit.\n+\t\t( bisect_state $state > \"$GIT_DIR/BISECT_RUN\" )\n+\t\tres=$?\n+\n+\t\tcat \"$GIT_DIR/BISECT_RUN\"\n+\n+\t\tif sane_grep \"first bad commit could be any of\" \"$GIT_DIR/BISECT_RUN\" \\\n+\t\t\t> /dev/null; then\n+\t\t\t(\n+\t\t\t\tgettext \"bisect run cannot continue any more\" &&\n+\t\t\t\techo\n+\t\t\t) >&2\n+\t\t\texit $res\n+\t\tfi\n+\n+\t\tif [ $res -ne 0 ]; then\n+\t\t\t(\n+\t\t\t\teval_gettext \"bisect run failed:\n 'bisect_state \\$state' exited with error code \\$res\" &&\n-\t      echo\n-\t  ) >&2\n-\t  exit $res\n-      fi\n+\t\t\t\techo\n+\t\t\t) >&2\n+\t\t\texit $res\n+\t\tfi\n \n-      if sane_grep \"is the first bad commit\" \"$GIT_DIR/BISECT_RUN\" > /dev/null; then\n-\t  gettext \"bisect run success\"; echo\n-\t  exit 0;\n-      fi\n+\t\tif sane_grep \"is the first bad commit\" \"$GIT_DIR/BISECT_RUN\" > /dev/null; then\n+\t\t\tgettext \"bisect run success\"; echo\n+\t\t\texit 0;\n+\t\tfi\n \n-    done\n+\tdone\n }\n \n bisect_log () {\n@@ -486,33 +486,33 @@ bisect_log () {\n \n case \"$#\" in\n 0)\n-    usage ;;\n+\tusage ;;\n *)\n-    cmd=\"$1\"\n-    shift\n-    case \"$cmd\" in\n-    help)\n-        git bisect -h ;;\n-    start)\n-        bisect_start \"$@\" ;;\n-    bad|good)\n-        bisect_state \"$cmd\" \"$@\" ;;\n-    skip)\n-        bisect_skip \"$@\" ;;\n-    next)\n-        # Not sure we want \"next\" at the UI level anymore.\n-        bisect_next \"$@\" ;;\n-    visualize|view)\n-\tbisect_visualize \"$@\" ;;\n-    reset)\n-        bisect_reset \"$@\" ;;\n-    replay)\n-\tbisect_replay \"$@\" ;;\n-    log)\n-\tbisect_log ;;\n-    run)\n-        bisect_run \"$@\" ;;\n-    *)\n-        usage ;;\n-    esac\n+\tcmd=\"$1\"\n+\tshift\n+\tcase \"$cmd\" in\n+\thelp)\n+\t\tgit bisect -h ;;\n+\tstart)\n+\t\tbisect_start \"$@\" ;;\n+\tbad|good)\n+\t\tbisect_state \"$cmd\" \"$@\" ;;\n+\tskip)\n+\t\tbisect_skip \"$@\" ;;\n+\tnext)\n+\t\t# Not sure we want \"next\" at the UI level anymore.\n+\t\tbisect_next \"$@\" ;;\n+\tvisualize|view)\n+\t\tbisect_visualize \"$@\" ;;\n+\treset)\n+\t\tbisect_reset \"$@\" ;;\n+\treplay)\n+\t\tbisect_replay \"$@\" ;;\n+\tlog)\n+\t\tbisect_log ;;\n+\trun)\n+\t\tbisect_run \"$@\" ;;\n+\t*)\n+\t\tusage ;;\n+\tesac\n esac\n-- \n1.7.6.354.g7f57d\n"},{"id":"172972","messageId":"1312543891-11079-3-git-send-email-jon.seymour@gmail.com","threadId":"28026","inReplyTo":"1312543891-11079-1-git-send-email-jon.seymour@gmail.com","subject":"[PATCH 2/2] bisect: replace \"; then\" with \"\\n<tab>*then\"","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-05T11:31:31Z","receivedAt":"2011-08-05T11:31:31Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Signed-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-bisect.sh |   27 ++++++++++++++++++---------\n 1 files changed, 18 insertions(+), 9 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex f5d9ede..1f3c46d 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -198,7 +198,8 @@ is_expected_rev() {\n \n check_expected_revs() {\n \tfor _rev in \"$@\"; do\n-\t\tif ! is_expected_rev \"$_rev\"; then\n+\t\tif ! is_expected_rev \"$_rev\"\n+\t\tthen\n \t\t\trm -f \"$GIT_DIR/BISECT_ANCESTORS_OK\"\n \t\t\trm -f \"$GIT_DIR/BISECT_EXPECTED_REV\"\n \t\t\treturn\n@@ -331,7 +332,8 @@ bisect_visualize() {\n \tif test $# = 0\n \tthen\n \t\tif test -n \"${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}\" &&\n-\t\t   type gitk >/dev/null 2>&1; then\n+\t\t   type gitk >/dev/null 2>&1\n+\t\tthen\n \t\t\tset gitk\n \t\telse\n \t\t\tset git log\n@@ -400,7 +402,8 @@ bisect_replay () {\n \twhile read git bisect command rev\n \tdo\n \t\ttest \"$git $bisect\" = \"git bisect\" -o \"$git\" = \"git-bisect\" || continue\n-\t\tif test \"$git\" = \"git-bisect\"; then\n+\t\tif test \"$git\" = \"git-bisect\"\n+\t\tthen\n \t\t\trev=\"$command\"\n \t\t\tcommand=\"$bisect\"\n \t\tfi\n@@ -428,7 +431,8 @@ bisect_run () {\n \t\tres=$?\n \n \t\t# Check for really bad run error.\n-\t\tif [ $res -lt 0 -o $res -ge 128 ]; then\n+\t\tif [ $res -lt 0 -o $res -ge 128 ]\n+\t\tthen\n \t\t\t(\n \t\t\t\teval_gettext \"bisect run failed:\n exit code \\$res from '\\$command' is < 0 or >= 128\" &&\n@@ -439,9 +443,11 @@ exit code \\$res from '\\$command' is < 0 or >= 128\" &&\n \n \t\t# Find current state depending on run success or failure.\n \t\t# A special exit code of 125 means cannot test.\n-\t\tif [ $res -eq 125 ]; then\n+\t\tif [ $res -eq 125 ]\n+\t\tthen\n \t\t\tstate='skip'\n-\t\telif [ $res -gt 0 ]; then\n+\t\telif [ $res -gt 0 ]\n+\t\tthen\n \t\t\tstate='bad'\n \t\telse\n \t\t\tstate='good'\n@@ -454,7 +460,8 @@ exit code \\$res from '\\$command' is < 0 or >= 128\" &&\n \t\tcat \"$GIT_DIR/BISECT_RUN\"\n \n \t\tif sane_grep \"first bad commit could be any of\" \"$GIT_DIR/BISECT_RUN\" \\\n-\t\t\t> /dev/null; then\n+\t\t\t> /dev/null\n+\t\tthen\n \t\t\t(\n \t\t\t\tgettext \"bisect run cannot continue any more\" &&\n \t\t\t\techo\n@@ -462,7 +469,8 @@ exit code \\$res from '\\$command' is < 0 or >= 128\" &&\n \t\t\texit $res\n \t\tfi\n \n-\t\tif [ $res -ne 0 ]; then\n+\t\tif [ $res -ne 0 ]\n+\t\tthen\n \t\t\t(\n \t\t\t\teval_gettext \"bisect run failed:\n 'bisect_state \\$state' exited with error code \\$res\" &&\n@@ -471,7 +479,8 @@ exit code \\$res from '\\$command' is < 0 or >= 128\" &&\n \t\t\texit $res\n \t\tfi\n \n-\t\tif sane_grep \"is the first bad commit\" \"$GIT_DIR/BISECT_RUN\" > /dev/null; then\n+\t\tif sane_grep \"is the first bad commit\" \"$GIT_DIR/BISECT_RUN\" > /dev/null\n+\t\tthen\n \t\t\tgettext \"bisect run success\"; echo\n \t\t\texit 0;\n \t\tfi\n-- \n1.7.6.354.g7f57d\n"},{"id":"172985","messageId":"7vsjpf3hvg.fsf@alter.siamese.dyndns.org","threadId":"28026","inReplyTo":"1312543891-11079-1-git-send-email-jon.seymour@gmail.com","subject":"Re: [PATCH 0/2] bisect: cleanup formatting of git-bisect.sh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-05T17:09:23Z","receivedAt":"2011-08-05T17:09:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> This series is intended to be applied on top js/bisect-no-checkout.\n\nThanks; I wonder if we want to go a bit further.\n\n-- >8 --\nSubject: bisect: further style nitpicks\n\nFix a few remaining lines that indented with spaces.\n\nAlso simplify the logic of checking out the original branch and reporting\nerror during \"bisect reset\".\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-bisect.sh |   18 ++++++++----------\n 1 files changed, 8 insertions(+), 10 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 1f3c46d..22c4da5 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -94,9 +94,9 @@ bisect_start() {\n \t\t\tdie \"$(eval_gettext \"unrecognised option: '\\$arg'\")\" ;;\n \t\t*)\n \t\t\trev=$(git rev-parse -q --verify \"$arg^{commit}\") || {\n-\t\t\t    test $has_double_dash -eq 1 &&\n-\t\t\tdie \"$(eval_gettext \"'\\$arg' does not appear to be a valid revision\")\"\n-\t\t\t    break\n+\t\t\t\ttest $has_double_dash -eq 1 &&\n+\t\t\t\tdie \"$(eval_gettext \"'\\$arg' does not appear to be a valid revision\")\"\n+\t\t\t\tbreak\n \t\t\t}\n \t\t\tcase $bad_seen in\n \t\t\t0) state='bad' ; bad_seen=1 ;;\n@@ -125,7 +125,7 @@ bisect_start() {\n \t\tstart_head=$(cat \"$GIT_DIR/BISECT_START\")\n \t\tif test \"z$mode\" != \"z--no-checkout\"\n \t\tthen\n-\t\t    git checkout \"$start_head\" --\n+\t\t\tgit checkout \"$start_head\" --\n \t\tfi\n \telse\n \t\t# Get rev from where we start.\n@@ -332,7 +332,7 @@ bisect_visualize() {\n \tif test $# = 0\n \tthen\n \t\tif test -n \"${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}\" &&\n-\t\t   type gitk >/dev/null 2>&1\n+\t\t\ttype gitk >/dev/null 2>&1\n \t\tthen\n \t\t\tset gitk\n \t\telse\n@@ -364,13 +364,11 @@ bisect_reset() {\n \t*)\n \t\tusage ;;\n \tesac\n-\tif ! test -f \"$GIT_DIR/BISECT_HEAD\"\n+\n+\tif ! test -f \"$GIT_DIR/BISECT_HEAD\" && ! git checkout \"$branch\" --\n \tthen\n-\t\tif ! git checkout \"$branch\" --\n-\t\tthen\n-\t\t\tdie \"$(eval_gettext \"Could not check out original HEAD '\\$branch'.\n+\t\tdie \"$(eval_gettext \"Could not check out original HEAD '\\$branch'.\n Try 'git bisect reset <commit>'.\")\"\n-\t\tfi\n \tfi\n \tbisect_clean_state\n }\n"},{"id":"173002","messageId":"CAH3AnrpaTkSzCiCbtPM7Wv63y-5M+d5DPzPdMrzy2Ys0jkiuBw@mail.gmail.com","threadId":"28026","inReplyTo":"7vsjpf3hvg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/2] bisect: cleanup formatting of git-bisect.sh","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2011-08-06T03:40:27Z","receivedAt":"2011-08-06T03:40:27Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sat, Aug 6, 2011 at 3:09 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jon Seymour <jon.seymour@gmail.com> writes:\n>\n>> This series is intended to be applied on top js/bisect-no-checkout.\n>\n> Thanks; I wonder if we want to go a bit further.\n>\n> -- >8 --\n> Subject: bisect: further style nitpicks\n>\n> Fix a few remaining lines that indented with spaces.\n>\n> Also simplify the logic of checking out the original branch and reporting\n> error during \"bisect reset\".\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  git-bisect.sh |   18 ++++++++----------\n>  1 files changed, 8 insertions(+), 10 deletions(-)\n>\n> diff --git a/git-bisect.sh b/git-bisect.sh\n> index 1f3c46d..22c4da5 100755\n> --- a/git-bisect.sh\n> +++ b/git-bisect.sh\n> @@ -94,9 +94,9 @@ bisect_start() {\n>                        die \"$(eval_gettext \"unrecognised option: '\\$arg'\")\" ;;\n>                *)\n>                        rev=$(git rev-parse -q --verify \"$arg^{commit}\") || {\n> -                           test $has_double_dash -eq 1 &&\n> -                       die \"$(eval_gettext \"'\\$arg' does not appear to be a valid revision\")\"\n> -                           break\n> +                               test $has_double_dash -eq 1 &&\n> +                               die \"$(eval_gettext \"'\\$arg' does not appear to be a valid revision\")\"\n> +                               break\n>                        }\n>                        case $bad_seen in\n>                        0) state='bad' ; bad_seen=1 ;;\n> @@ -125,7 +125,7 @@ bisect_start() {\n>                start_head=$(cat \"$GIT_DIR/BISECT_START\")\n>                if test \"z$mode\" != \"z--no-checkout\"\n>                then\n> -                   git checkout \"$start_head\" --\n> +                       git checkout \"$start_head\" --\n>                fi\n>        else\n>                # Get rev from where we start.\n> @@ -332,7 +332,7 @@ bisect_visualize() {\n>        if test $# = 0\n>        then\n>                if test -n \"${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}\" &&\n> -                  type gitk >/dev/null 2>&1\n> +                       type gitk >/dev/null 2>&1\n>                then\n>                        set gitk\n>                else\n> @@ -364,13 +364,11 @@ bisect_reset() {\n>        *)\n>                usage ;;\n>        esac\n> -       if ! test -f \"$GIT_DIR/BISECT_HEAD\"\n> +\n> +       if ! test -f \"$GIT_DIR/BISECT_HEAD\" && ! git checkout \"$branch\" --\n>        then\n> -               if ! git checkout \"$branch\" --\n> -               then\n> -                       die \"$(eval_gettext \"Could not check out original HEAD '\\$branch'.\n> +               die \"$(eval_gettext \"Could not check out original HEAD '\\$branch'.\n>  Try 'git bisect reset <commit>'.\")\"\n> -               fi\n>        fi\n>        bisect_clean_state\n>  }\n>\n\nLooks good, thanks.\n\njon.\n"}]}