]>
Commit | Line | Data |
---|---|---|
00f66f0e | 1 | #!/bin/sh |
beb17217 CB |
2 | |
3 | test_description='git rebase - test patch id computation' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
b687cd6a | 7 | scramble () { |
beb17217 CB |
8 | i=0 |
9 | while read x | |
10 | do | |
11 | if test $i -ne 0 | |
12 | then | |
13 | echo "$x" | |
14 | fi | |
00f66f0e | 15 | i=$((($i+1) % 10)) |
b687cd6a | 16 | done <"$1" >"$1.new" |
beb17217 CB |
17 | mv -f "$1.new" "$1" |
18 | } | |
19 | ||
beb17217 | 20 | test_expect_success 'setup' ' |
02380389 | 21 | git commit --allow-empty -m initial && |
beb17217 CB |
22 | git tag root |
23 | ' | |
24 | ||
bb2dbe30 JK |
25 | test_expect_success 'setup: 500 lines' ' |
26 | rm -f .gitattributes && | |
27 | git checkout -q -f master && | |
28 | git reset --hard root && | |
29 | test_seq 500 >file && | |
30 | git add file && | |
31 | git commit -q -m initial && | |
32 | git branch -f other && | |
33 | ||
34 | scramble file && | |
35 | git add file && | |
36 | git commit -q -m "change big file" && | |
37 | ||
38 | git checkout -q other && | |
39 | : >newfile && | |
40 | git add newfile && | |
41 | git commit -q -m "add small file" && | |
42 | ||
43 | git cherry-pick master >/dev/null 2>&1 | |
44 | ' | |
beb17217 | 45 | |
bb2dbe30 JK |
46 | test_expect_success 'setup attributes' ' |
47 | echo "file binary" >.gitattributes | |
48 | ' | |
beb17217 | 49 | |
bb2dbe30 JK |
50 | test_expect_success 'detect upstream patch' ' |
51 | git checkout -q master && | |
52 | scramble file && | |
53 | git add file && | |
54 | git commit -q -m "change big file again" && | |
55 | git checkout -q other^{} && | |
56 | git rebase master && | |
21e3bb12 JH |
57 | git rev-list master...HEAD~ >revs && |
58 | test_must_be_empty revs | |
bb2dbe30 | 59 | ' |
beb17217 | 60 | |
bb2dbe30 JK |
61 | test_expect_success 'do not drop patch' ' |
62 | git branch -f squashed master && | |
63 | git checkout -q -f squashed && | |
64 | git reset -q --soft HEAD~2 && | |
65 | git commit -q -m squashed && | |
66 | git checkout -q other^{} && | |
67 | test_must_fail git rebase squashed && | |
68 | git rebase --quit | |
69 | ' | |
beb17217 CB |
70 | |
71 | test_done |