Revision d16dc428b47837cebd231de1fad76d9c307f34b0 authored by Nguyễn Thái Ngọc Duy on 20 June 2019, 09:55:21 UTC, committed by Junio C Hamano on 20 June 2019, 20:31:22 UTC
In c45f0f525d (switch: reject if some operation is in progress,
2019-03-29), a check is added to prevent switching when some operation
is in progress. The reason is it's often not safe to do so.

This is true for merge, am, rebase, cherry-pick and revert, but not so
much for bisect because bisecting is basically jumping/switching between
a bunch of commits to pin point the first bad one. git-bisect suggests
the next commit to test, but it's not wrong for the user to test a
different commit because git-bisect cannot have the knowledge to know
better.

For this reason, allow to switch when bisecting (*). I considered if we
should still prevent switching by default and allow it with
--ignore-in-progress. But I don't think the prevention really adds
anything much.

If the user switches away by mistake, since we print the previous HEAD
value, even if they don't know about the "-" shortcut, switching back is
still possible.

The warning will be printed on every switch while bisect is still
ongoing, not the first time you switch away from bisect's suggested
commit, so it could become a bit annoying.

(*) of course when it's safe to do so, i.e. no loss of local changes and
stuff.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent bcba406
History
File Mode Size
arithmetic-expansion.expect -rw-r--r-- 75 bytes
arithmetic-expansion.test -rw-r--r-- 174 bytes
bash-array.expect -rw-r--r-- 87 bytes
bash-array.test -rw-r--r-- 230 bytes
blank-line.expect -rw-r--r-- 28 bytes
blank-line.test -rw-r--r-- 181 bytes
block.expect -rw-r--r-- 75 bytes
block.test -rw-r--r-- 251 bytes
broken-chain.expect -rw-r--r-- 38 bytes
broken-chain.test -rw-r--r-- 129 bytes
case.expect -rw-r--r-- 208 bytes
case.test -rw-r--r-- 398 bytes
close-nested-and-parent-together.expect -rw-r--r-- 32 bytes
close-nested-and-parent-together.test -rw-r--r-- 28 bytes
close-subshell.expect -rw-r--r-- 150 bytes
close-subshell.test -rw-r--r-- 212 bytes
command-substitution.expect -rw-r--r-- 78 bytes
command-substitution.test -rw-r--r-- 173 bytes
comment.expect -rw-r--r-- 28 bytes
comment.test -rw-r--r-- 263 bytes
complex-if-in-cuddled-loop.expect -rw-r--r-- 165 bytes
complex-if-in-cuddled-loop.test -rw-r--r-- 297 bytes
cuddled-if-then-else.expect -rw-r--r-- 79 bytes
cuddled-if-then-else.test -rw-r--r-- 147 bytes
cuddled-loop.expect -rw-r--r-- 78 bytes
cuddled-loop.test -rw-r--r-- 268 bytes
cuddled.expect -rw-r--r-- 122 bytes
cuddled.test -rw-r--r-- 432 bytes
exit-loop.expect -rw-r--r-- 205 bytes
exit-loop.test -rw-r--r-- 424 bytes
exit-subshell.expect -rw-r--r-- 33 bytes
exit-subshell.test -rw-r--r-- 101 bytes
for-loop.expect -rw-r--r-- 109 bytes
for-loop.test -rw-r--r-- 308 bytes
here-doc-close-subshell.expect -rw-r--r-- 9 bytes
here-doc-close-subshell.test -rw-r--r-- 89 bytes
here-doc-multi-line-command-subst.expect -rw-r--r-- 48 bytes
here-doc-multi-line-command-subst.test -rw-r--r-- 132 bytes
here-doc-multi-line-string.expect -rw-r--r-- 50 bytes
here-doc-multi-line-string.test -rw-r--r-- 123 bytes
here-doc.expect -rw-r--r-- 107 bytes
here-doc.test -rw-r--r-- 573 bytes
if-in-loop.expect -rw-r--r-- 110 bytes
if-in-loop.test -rw-r--r-- 179 bytes
if-then-else.expect -rw-r--r-- 204 bytes
if-then-else.test -rw-r--r-- 523 bytes
incomplete-line.expect -rw-r--r-- 68 bytes
incomplete-line.test -rw-r--r-- 198 bytes
inline-comment.expect -rw-r--r-- 103 bytes
inline-comment.test -rw-r--r-- 371 bytes
loop-in-if.expect -rw-r--r-- 110 bytes
loop-in-if.test -rw-r--r-- 179 bytes
multi-line-nested-command-substitution.expect -rw-r--r-- 147 bytes
multi-line-nested-command-substitution.test -rw-r--r-- 139 bytes
multi-line-string.expect -rw-r--r-- 232 bytes
multi-line-string.test -rw-r--r-- 389 bytes
negated-one-liner.expect -rw-r--r-- 92 bytes
negated-one-liner.test -rw-r--r-- 172 bytes
nested-cuddled-subshell.expect -rw-r--r-- 179 bytes
nested-cuddled-subshell.test -rw-r--r-- 440 bytes
nested-here-doc.expect -rw-r--r-- 47 bytes
nested-here-doc.test -rw-r--r-- 470 bytes
nested-subshell-comment.expect -rw-r--r-- 141 bytes
nested-subshell-comment.test -rw-r--r-- 235 bytes
nested-subshell.expect -rw-r--r-- 97 bytes
nested-subshell.test -rw-r--r-- 167 bytes
one-liner.expect -rw-r--r-- 138 bytes
one-liner.test -rw-r--r-- 270 bytes
p4-filespec.expect -rw-r--r-- 53 bytes
p4-filespec.test -rw-r--r-- 127 bytes
pipe.expect -rw-r--r-- 55 bytes
pipe.test -rw-r--r-- 153 bytes
semicolon.expect -rw-r--r-- 271 bytes
semicolon.test -rw-r--r-- 466 bytes
subshell-here-doc.expect -rw-r--r-- 143 bytes
subshell-here-doc.test -rw-r--r-- 620 bytes
subshell-one-liner.expect -rw-r--r-- 260 bytes
subshell-one-liner.test -rw-r--r-- 491 bytes
t7900-subtree.expect -rw-r--r-- 241 bytes
t7900-subtree.test -rw-r--r-- 277 bytes
while-loop.expect -rw-r--r-- 104 bytes
while-loop.test -rw-r--r-- 306 bytes

back to top