Skip to content

Commit e9fe74c

Browse files
peffgitster
authored andcommitted
t3503: test cherry picking and reverting root commits
We already tested cherry-picking a root commit, but only with the internal merge-recursive strategy. Let's also test the recently-allowed reverting of a root commit, as well as testing with external strategies (which until recently triggered a segfault). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fad2652 commit e9fe74c

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

t/t3503-cherry-pick-root.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
test_description='test cherry-picking a root commit'
3+
test_description='test cherry-picking (and reverting) a root commit'
44

55
. ./test-lib.sh
66

@@ -23,7 +23,30 @@ test_expect_success setup '
2323
test_expect_success 'cherry-pick a root commit' '
2424
2525
git cherry-pick master &&
26-
test first = $(cat file1)
26+
echo first >expect &&
27+
test_cmp expect file1
28+
29+
'
30+
31+
test_expect_success 'revert a root commit' '
32+
33+
git revert master &&
34+
test_path_is_missing file1
35+
36+
'
37+
38+
test_expect_success 'cherry-pick a root commit with an external strategy' '
39+
40+
git cherry-pick --strategy=resolve master &&
41+
echo first >expect &&
42+
test_cmp expect file1
43+
44+
'
45+
46+
test_expect_success 'revert a root commit with an external strategy' '
47+
48+
git revert --strategy=resolve master &&
49+
test_path_is_missing file1
2750
2851
'
2952

0 commit comments

Comments
 (0)