summaryrefslogtreecommitdiff
path: root/t/t3501-revert-cherry-pick.sh
diff options
context:
space:
mode:
authorHiroshige Umino <hiroshige88@gmail.com>2013-09-05 23:57:23 +0900
committerJunio C Hamano <gitster@pobox.com>2013-09-09 11:17:11 -0700
commit182d7dc46b23b4a20985c93ea3a6ba3e6f267ff6 (patch)
treecc2b74ef4b6f2a29d9eeed5e3dd6c2967c1ef6b9 /t/t3501-revert-cherry-pick.sh
parente5be297279e8ee8c503eb59da21ab17edc40e748 (diff)
downloadgit-182d7dc46b23b4a20985c93ea3a6ba3e6f267ff6.tar.gz
cherry-pick: allow "-" as abbreviation of '@{-1}'
"-" abbreviation is handy for "cherry-pick" like "checkout" and "merge". It's also good for uniformity that a "-" stands as the name of the previous branch where a branch name is accepted and it could not mean any other things like stdin. Signed-off-by: Hiroshige Umino <hiroshige88@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 6f489e20ee..6281619141 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -109,4 +109,24 @@ test_expect_success 'chery-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