Sync with 2.42.2
[git.git] / t / t3438-rebase-broken-files.sh
blobc614c4f2e4ba285ba7ffc6b7b4384b69f0b9a851
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_done