Fourth batch
[git/raj.git] / t / t3419-rebase-patch-id.sh
blob1f32faa4a4db3d0307365af0c9cbd5bf58ff964f
1 #!/bin/sh
3 test_description='git rebase - test patch id computation'
5 . ./test-lib.sh
7 scramble () {
8 i=0
9 while read x
11 if test $i -ne 0
12 then
13 echo "$x"
15 i=$((($i+1) % 10))
16 done <"$1" >"$1.new"
17 mv -f "$1.new" "$1"
20 test_expect_success 'setup' '
21 git commit --allow-empty -m initial &&
22 git tag root
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 &&
34 scramble file &&
35 git add file &&
36 git commit -q -m "change big file" &&
38 git checkout -q other &&
39 : >newfile &&
40 git add newfile &&
41 git commit -q -m "add small file" &&
43 git cherry-pick master >/dev/null 2>&1
46 test_expect_success 'setup attributes' '
47 echo "file binary" >.gitattributes
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 &&
57 git rev-list master...HEAD~ >revs &&
58 test_must_be_empty revs
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
71 test_done