aboutsummaryrefslogtreecommitdiff
path: root/t/t3501-revert-cherry-pick.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-20 12:29:57 -0700
committerJunio C Hamano <gitster@pobox.com>2013-09-20 12:29:58 -0700
commit08092082b7ba6435662310a945c7c96e42278f0a (patch)
tree426a2114be21571015d813c5f48b393b978753d6 /t/t3501-revert-cherry-pick.sh
parent6d3e1f2e453f7473d4ab64ef378309958613c5d7 (diff)
parent182d7dc46b23b4a20985c93ea3a6ba3e6f267ff6 (diff)
downloadgit-08092082b7ba6435662310a945c7c96e42278f0a.tar.gz
git-08092082b7ba6435662310a945c7c96e42278f0a.tar.xz
Merge branch 'hu/cherry-pick-previous-branch'
Just like "git checkout -" knows to check out and "git merge -" knows to merge the branch you were previously on, "git cherry-pick" now understands "git cherry-pick -" to pick from the previous branch. * hu/cherry-pick-previous-branch: cherry-pick: allow "-" as abbreviation of '@{-1}'
Diffstat (limited to 't/t3501-revert-cherry-pick.sh')
-rwxr-xr-xt/t3501-revert-cherry-pick.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 46aaf2f51..bff6ffe08 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -109,4 +109,24 @@ test_expect_success 'cherry-pick on unborn branch' '
! test_cmp_rev initial HEAD
'
+test_expect_success 'cherry-pick "-" to pick from previous branch' '
+ git checkout unborn &&
+ test_commit to-pick actual content &&
+ git checkout master &&
+ git cherry-pick - &&
+ echo content >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'cherry-pick "-" is meaningless without checkout' '
+ test_create_repo afresh &&
+ (
+ cd afresh &&
+ test_commit one &&
+ test_commit two &&
+ test_commit three &&
+ test_must_fail git cherry-pick -
+ )
+'
+
test_done