aboutsummaryrefslogtreecommitdiff
path: root/t/t3510-cherry-pick-sequence.sh
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2011-08-04 16:09:13 +0530
committerJunio C Hamano <gitster@pobox.com>2011-08-08 09:24:50 -0700
commit2d27daa91da1d6376916533de2ec4b50e6acc925 (patch)
tree53277023e2b5fe91f4306f5cb2e74015b20036d7 /t/t3510-cherry-pick-sequence.sh
parent95eb88d8ee588d89b4f06d2753ed4d16ab13b39f (diff)
downloadgit-2d27daa91da1d6376916533de2ec4b50e6acc925.tar.gz
git-2d27daa91da1d6376916533de2ec4b50e6acc925.tar.xz
revert: Remove sequencer state when no commits are pending
When cherry-pick or revert is called on a list of commits, and a conflict encountered somewhere in the middle, the data in ".git/sequencer" is required to continue the operation. However, when a conflict is encountered in the very last commit, the user will have to "continue" after resolving the conflict and committing just so that the sequencer state is removed. This is how the current "rebase -i" script works as well. $ git cherry-pick foo..bar ... conflict encountered while picking "bar" ... $ echo "resolved" >problematicfile $ git add problematicfile $ git commit $ git cherry-pick --continue # This would be a no-op Change this so that the sequencer state is cleared when a conflict is encountered in the last commit. Incidentally, this patch makes sure that some existing tests don't break when features like "--reset" and "--continue" are implemented later in the series. A better way to implement this feature is to get the last "git commit" to remove the sequencer state. However, that requires tighter coupling between "git commit" and the sequencer, a goal that can be pursued once the sequencer is made more general. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3510-cherry-pick-sequence.sh')
-rwxr-xr-xt/t3510-cherry-pick-sequence.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index fd6986541..a41408657 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -82,4 +82,28 @@ test_expect_success '--reset cleans up sequencer state' '
test_path_is_missing .git/sequencer
'
+test_expect_success 'cherry-pick cleans up sequencer state when one commit is left' '
+ pristine_detach initial &&
+ test_must_fail git cherry-pick base..picked &&
+ test_path_is_missing .git/sequencer &&
+ echo "resolved" >foo &&
+ git add foo &&
+ git commit &&
+ {
+ git rev-list HEAD |
+ git diff-tree --root --stdin |
+ sed "s/$_x40/OBJID/g"
+ } >actual &&
+ cat >expect <<-\EOF &&
+ OBJID
+ :100644 100644 OBJID OBJID M foo
+ OBJID
+ :100644 100644 OBJID OBJID M unrelated
+ OBJID
+ :000000 100644 OBJID OBJID A foo
+ :000000 100644 OBJID OBJID A unrelated
+ EOF
+ test_cmp expect actual
+'
+
test_done