Revert "Add a helper function to compare file contents"
[alt-git.git] / t / t3438-rebase-broken-files.sh
blobb92a3ce46b8cc044e44adfa9cc807c2d2ddb4af2
1 #!/bin/sh
3 test_description='rebase behavior when on-disk files are broken'
4 . ./test-lib.sh
6 test_expect_success 'set up conflicting branches' '
7 test_commit base file &&
8 git checkout -b branch1 &&
9 test_commit one file &&
10 git checkout -b branch2 HEAD^ &&
11 test_commit two file
14 create_conflict () {
15 test_when_finished "git rebase --abort" &&
16 git checkout -B tmp branch2 &&
17 test_must_fail git rebase branch1
20 check_resolve_fails () {
21 echo resolved >file &&
22 git add file &&
23 test_must_fail git rebase --continue
26 for item in NAME EMAIL DATE
28 test_expect_success "detect missing GIT_AUTHOR_$item" '
29 create_conflict &&
31 grep -v $item .git/rebase-merge/author-script >tmp &&
32 mv tmp .git/rebase-merge/author-script &&
34 check_resolve_fails
36 done
38 for item in NAME EMAIL DATE
40 test_expect_success "detect duplicate GIT_AUTHOR_$item" '
41 create_conflict &&
43 grep -i $item .git/rebase-merge/author-script >tmp &&
44 cat tmp >>.git/rebase-merge/author-script &&
46 check_resolve_fails
48 done
50 test_expect_success 'unknown key in author-script' '
51 create_conflict &&
53 echo "GIT_AUTHOR_BOGUS=${SQ}whatever${SQ}" \
54 >>.git/rebase-merge/author-script &&
56 check_resolve_fails
59 test_done