]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3438-rebase-broken-files.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t3438-rebase-broken-files.sh
CommitLineData
45350aeb
JK
1#!/bin/sh
2
3test_description='rebase behavior when on-disk files are broken'
9ff2f060
ÆAB
4
5TEST_PASSES_SANITIZE_LEAK=true
45350aeb
JK
6. ./test-lib.sh
7
8test_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
14'
15
16create_conflict () {
17 test_when_finished "git rebase --abort" &&
18 git checkout -B tmp branch2 &&
19 test_must_fail git rebase branch1
20}
21
22check_resolve_fails () {
23 echo resolved >file &&
24 git add file &&
25 test_must_fail git rebase --continue
26}
27
28for item in NAME EMAIL DATE
29do
30 test_expect_success "detect missing GIT_AUTHOR_$item" '
31 create_conflict &&
32
33 grep -v $item .git/rebase-merge/author-script >tmp &&
34 mv tmp .git/rebase-merge/author-script &&
35
36 check_resolve_fails
37 '
38done
39
40for item in NAME EMAIL DATE
41do
42 test_expect_success "detect duplicate GIT_AUTHOR_$item" '
43 create_conflict &&
44
45 grep -i $item .git/rebase-merge/author-script >tmp &&
46 cat tmp >>.git/rebase-merge/author-script &&
47
48 check_resolve_fails
49 '
50done
51
52test_expect_success 'unknown key in author-script' '
53 create_conflict &&
54
55 echo "GIT_AUTHOR_BOGUS=${SQ}whatever${SQ}" \
56 >>.git/rebase-merge/author-script &&
57
58 check_resolve_fails
59'
60
647e870a
JK
61test_expect_success POSIXPERM,SANITY 'unwritable rebased-patches does not leak' '
62 >.git/rebased-patches &&
63 chmod a-w .git/rebased-patches &&
64
65 git checkout -b side HEAD^ &&
66 test_commit unrelated &&
67 test_must_fail git rebase --apply --onto tmp HEAD^
68'
69
45350aeb 70test_done