interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t3438-rebase-broken-files.sh

69 lines · 1465 bytes Raw Blame History
1#!/bin/sh
2
3test_description='rebase behavior when on-disk files are broken'
4
5. ./test-lib.sh
6
7test_expect_success 'set up conflicting branches' '
8 test_commit base file &&
9 git checkout -b branch1 &&
10 test_commit one file &&
11 git checkout -b branch2 HEAD^ &&
12 test_commit two file
13'
14
15create_conflict () {
16 test_when_finished "git rebase --abort" &&
17 git checkout -B tmp branch2 &&
18 test_must_fail git rebase branch1
19}
20
21check_resolve_fails () {
22 echo resolved >file &&
23 git add file &&
24 test_must_fail git rebase --continue
25}
26
27for item in NAME EMAIL DATE
28do
29 test_expect_success "detect missing GIT_AUTHOR_$item" '
30 create_conflict &&
31
32 grep -v $item .git/rebase-merge/author-script >tmp &&
33 mv tmp .git/rebase-merge/author-script &&
34
35 check_resolve_fails
36 '
37done
38
39for item in NAME EMAIL DATE
40do
41 test_expect_success "detect duplicate GIT_AUTHOR_$item" '
42 create_conflict &&
43
44 grep -i $item .git/rebase-merge/author-script >tmp &&
45 cat tmp >>.git/rebase-merge/author-script &&
46
47 check_resolve_fails
48 '
49done
50
51test_expect_success 'unknown key in author-script' '
52 create_conflict &&
53
54 echo "GIT_AUTHOR_BOGUS=${SQ}whatever${SQ}" \
55 >>.git/rebase-merge/author-script &&
56
57 check_resolve_fails
58'
59
60test_expect_success POSIXPERM,SANITY 'unwritable rebased-patches does not leak' '
61 >.git/rebased-patches &&
62 chmod a-w .git/rebased-patches &&
63
64 git checkout -b side HEAD^ &&
65 test_commit unrelated &&
66 test_must_fail git rebase --apply --onto tmp HEAD^
67'
68
69test_done