]>
Commit | Line | Data |
---|---|---|
e77f489e YD |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland | |
4 | # | |
5 | ||
6 | test_description='git rebase should detect patches integrated upstream | |
7 | ||
8 | This test cherry-picks one local change of two into master branch, and | |
9 | checks that git rebase succeeds with only the second patch in the | |
10 | local branch. | |
11 | ' | |
12 | . ./test-lib.sh | |
13 | ||
f73e5ee5 | 14 | test_expect_success 'prepare repository with topic branch' ' |
13c907c4 | 15 | test_commit A && |
f73e5ee5 | 16 | git checkout -b my-topic-branch && |
13c907c4 MZ |
17 | test_commit B && |
18 | test_commit C && | |
f73e5ee5 | 19 | git checkout -f master && |
13c907c4 | 20 | test_commit A2 A.t |
e77f489e YD |
21 | ' |
22 | ||
f73e5ee5 | 23 | test_expect_success 'pick top patch from topic branch into master' ' |
13c907c4 MZ |
24 | git cherry-pick C && |
25 | git checkout -f my-topic-branch | |
e77f489e YD |
26 | ' |
27 | ||
f73e5ee5 MZ |
28 | test_debug ' |
29 | git cherry master && | |
30 | git format-patch -k --stdout --full-index master >/dev/null && | |
31 | gitk --all & sleep 1 | |
e77f489e YD |
32 | ' |
33 | ||
f73e5ee5 MZ |
34 | test_expect_success 'rebase topic branch against new master and check git am did not get halted' ' |
35 | git rebase master && | |
13c907c4 | 36 | test_path_is_missing .git/rebase-apply |
f73e5ee5 | 37 | ' |
e77f489e | 38 | |
f73e5ee5 | 39 | test_expect_success 'rebase --merge topic branch that was partially merged upstream' ' |
13c907c4 MZ |
40 | git reset --hard C && |
41 | git rebase --merge master && | |
42 | test_path_is_missing .git/rebase-merge | |
f73e5ee5 | 43 | ' |
9a99c087 | 44 | |
2b5ba7b0 MZ |
45 | test_expect_success 'rebase ignores empty commit' ' |
46 | git reset --hard A && | |
47 | git commit --allow-empty -m empty && | |
48 | test_commit D && | |
49 | git rebase C && | |
25428403 MZ |
50 | test "$(git log --format=%s C..)" = "D" |
51 | ' | |
52 | ||
53 | test_expect_success 'rebase --keep-empty' ' | |
54 | git reset --hard D && | |
55 | git rebase --keep-empty C && | |
56 | test "$(git log --format=%s C..)" = "D | |
57 | empty" | |
58 | ' | |
59 | ||
60 | test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' ' | |
61 | git reset --hard A && | |
62 | git commit --allow-empty -m also-empty && | |
63 | git rebase --keep-empty D && | |
64 | test "$(git log --format=%s A..)" = "also-empty | |
65 | D | |
66 | empty" | |
2b5ba7b0 MZ |
67 | ' |
68 | ||
e77f489e | 69 | test_done |