diff options
author | Martin von Zweigbergk <martinvonz@gmail.com> | 2012-12-21 11:10:11 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-23 10:40:37 -0800 |
commit | 334ae397452170dacfcd8e69e4a41f6a64f54eec (patch) | |
tree | 10195585b9d28180cd58df7e43e975016359cdf6 /t | |
parent | tests: move test_cmp_rev to test-lib-functions (diff) | |
download | tgif-334ae397452170dacfcd8e69e4a41f6a64f54eec.tar.xz |
learn to pick/revert into unborn branch
cherry-picking into an unborn branch should work, so make it work,
with or without --ff.
Cherry-picking anything other than a commit that only adds files, will
naturally result in conflicts. Similarly, revert also works, but will
result in conflicts unless the specified revision only deletes files.
Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t3501-revert-cherry-pick.sh | 9 | ||||
-rwxr-xr-x | t/t3506-cherry-pick-ff.sh | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 34c86e5de6..6f489e20ee 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -100,4 +100,13 @@ test_expect_success 'revert forbidden on dirty working tree' ' ' +test_expect_success 'chery-pick on unborn branch' ' + git checkout --orphan unborn && + git rm --cached -r . && + rm -rf * && + git cherry-pick initial && + git diff --quiet initial && + ! test_cmp_rev initial HEAD +' + test_done diff --git a/t/t3506-cherry-pick-ff.sh b/t/t3506-cherry-pick-ff.sh index 51ca391e47..373aad623c 100755 --- a/t/t3506-cherry-pick-ff.sh +++ b/t/t3506-cherry-pick-ff.sh @@ -105,4 +105,12 @@ test_expect_success 'cherry pick a root commit with --ff' ' test "$(git rev-parse --verify HEAD)" = "1df192cd8bc58a2b275d842cede4d221ad9000d1" ' +test_expect_success 'chery-pick --ff on unborn branch' ' + git checkout --orphan unborn && + git rm --cached -r . && + rm -rf * && + git cherry-pick --ff first && + test_cmp_rev first HEAD +' + test_done |