3 # Copyright (c) 2019 Denton Liu
6 test_description='git rebase --fork-point test'
10 # A---B---D---E (master)
14 # C was formerly part of master but master was rewound to remove C
16 test_expect_success setup '
21 git reset --hard HEAD^ &&
32 test_expect_success "git rebase $*" "
33 git checkout master &&
38 test_write_lines $expected >expect &&
39 git log --pretty=%s >actual &&
40 test_cmp expect actual
44 test_rebase 'G F E D B A'
45 test_rebase 'G F D B A' --onto D
46 test_rebase 'G F B A' --keep-base
47 test_rebase 'G F C E D B A' --no-fork-point
48 test_rebase 'G F C D B A' --no-fork-point --onto D
49 test_rebase 'G F C B A' --no-fork-point --keep-base
51 test_rebase 'G F E D B A' --fork-point refs/heads/master
52 test_rebase 'G F E D B A' --fork-point master
54 test_rebase 'G F D B A' --fork-point --onto D refs/heads/master
55 test_rebase 'G F D B A' --fork-point --onto D master
57 test_rebase 'G F B A' --fork-point --keep-base refs/heads/master
58 test_rebase 'G F B A' --fork-point --keep-base master
60 test_rebase 'G F C E D B A' refs/heads/master
61 test_rebase 'G F C E D B A' master
63 test_rebase 'G F C D B A' --onto D refs/heads/master
64 test_rebase 'G F C D B A' --onto D master
66 test_rebase 'G F C B A' --keep-base refs/heads/master
67 test_rebase 'G F C B A' --keep-base master
69 test_expect_success 'git rebase --fork-point with ambigous refname' '
70 git checkout master &&
71 git checkout -b one &&
74 test_must_fail git rebase --fork-point --onto D one