f80a87262a
The option to "git cherry-pick" and "git revert" to discard the sequencer state introduced by v1.7.8-rc0~141^2~6 (revert: Introduce --reset to remove sequencer state, 2011-08-04) has a confusing name. Change it now, while we still have the time. The new name for "cherry-pick, please get out of my way, since I've long forgotten about the sequence of commits I was cherry-picking when you wrote that old .git/sequencer directory" is --quit. Mnemonic: this is analagous to quiting a program the user is no longer using --- we just want to get out of the multiple-command cherry-pick procedure and not to reset HEAD or rewind any other old state. The "--reset" option is kept as a synonym to minimize the impact. We might consider dropping it for simplicity in a separate patch, though. Adjust documentation and tests to use the newly preferred name (--quit) instead of --reset. While at it, let's clarify the short descriptions of these operations in "-h" output. Before: --reset forget the current operation --continue continue the current operation After: --quit end revert or cherry-pick sequence --continue resume revert or cherry-pick sequence Noticed-by: Phil Hord <phil.hord@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='Test interaction of reset --hard with sequencer
|
|
|
|
+ anotherpick: rewrites foo to d
|
|
+ picked: rewrites foo to c
|
|
+ unrelatedpick: rewrites unrelated to reallyunrelated
|
|
+ base: rewrites foo to b
|
|
+ initial: writes foo as a, unrelated as unrelated
|
|
'
|
|
|
|
. ./test-lib.sh
|
|
|
|
pristine_detach () {
|
|
git cherry-pick --quit &&
|
|
git checkout -f "$1^0" &&
|
|
git read-tree -u --reset HEAD &&
|
|
git clean -d -f -f -q -x
|
|
}
|
|
|
|
test_expect_success setup '
|
|
echo unrelated >unrelated &&
|
|
git add unrelated &&
|
|
test_commit initial foo a &&
|
|
test_commit base foo b &&
|
|
test_commit unrelatedpick unrelated reallyunrelated &&
|
|
test_commit picked foo c &&
|
|
test_commit anotherpick foo d &&
|
|
git config advice.detachedhead false
|
|
|
|
'
|
|
|
|
test_expect_success 'reset --hard cleans up sequencer state, providing one-level undo' '
|
|
pristine_detach initial &&
|
|
test_must_fail git cherry-pick base..anotherpick &&
|
|
test_path_is_dir .git/sequencer &&
|
|
git reset --hard &&
|
|
test_path_is_missing .git/sequencer &&
|
|
test_path_is_dir .git/sequencer-old &&
|
|
git reset --hard &&
|
|
test_path_is_missing .git/sequencer-old
|
|
'
|
|
|
|
test_done
|