git-prompt: use here-doc instead of here-string
[git/gitster.git] / t / t3438-rebase-broken-files.sh
blob821f08e5afb6983cf8f69abc525a54b6274885e6
1 #!/bin/sh
3 test_description='rebase behavior when on-disk files are broken'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'set up conflicting branches' '
9 test_commit base file &&
10 git checkout -b branch1 &&
11 test_commit one file &&
12 git checkout -b branch2 HEAD^ &&
13 test_commit two file
16 create_conflict () {
17 test_when_finished "git rebase --abort" &&
18 git checkout -B tmp branch2 &&
19 test_must_fail git rebase branch1
22 check_resolve_fails () {
23 echo resolved >file &&
24 git add file &&
25 test_must_fail git rebase --continue
28 for item in NAME EMAIL DATE
30 test_expect_success "detect missing GIT_AUTHOR_$item" '
31 create_conflict &&
33 grep -v $item .git/rebase-merge/author-script >tmp &&
34 mv tmp .git/rebase-merge/author-script &&
36 check_resolve_fails
38 done
40 for item in NAME EMAIL DATE
42 test_expect_success "detect duplicate GIT_AUTHOR_$item" '
43 create_conflict &&
45 grep -i $item .git/rebase-merge/author-script >tmp &&
46 cat tmp >>.git/rebase-merge/author-script &&
48 check_resolve_fails
50 done
52 test_expect_success 'unknown key in author-script' '
53 create_conflict &&
55 echo "GIT_AUTHOR_BOGUS=${SQ}whatever${SQ}" \
56 >>.git/rebase-merge/author-script &&
58 check_resolve_fails
61 test_expect_success POSIXPERM,SANITY 'unwritable rebased-patches does not leak' '
62 >.git/rebased-patches &&
63 chmod a-w .git/rebased-patches &&
65 git checkout -b side HEAD^ &&
66 test_commit unrelated &&
67 test_must_fail git rebase --apply --onto tmp HEAD^
70 test_done