Welcome to mirror list, hosted at ThFree Co, Russian Federation.

t3438-rebase-broken-files.sh « t - git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c614c4f2e4ba285ba7ffc6b7b4384b69f0b9a851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh

test_description='rebase behavior when on-disk files are broken'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'set up conflicting branches' '
	test_commit base file &&
	git checkout -b branch1 &&
	test_commit one file &&
	git checkout -b branch2 HEAD^ &&
	test_commit two file
'

create_conflict () {
	test_when_finished "git rebase --abort" &&
	git checkout -B tmp branch2 &&
	test_must_fail git rebase branch1
}

check_resolve_fails () {
	echo resolved >file &&
	git add file &&
	test_must_fail git rebase --continue
}

for item in NAME EMAIL DATE
do
	test_expect_success "detect missing GIT_AUTHOR_$item" '
		create_conflict &&

		grep -v $item .git/rebase-merge/author-script >tmp &&
		mv tmp .git/rebase-merge/author-script &&

		check_resolve_fails
	'
done

for item in NAME EMAIL DATE
do
	test_expect_success "detect duplicate GIT_AUTHOR_$item" '
		create_conflict &&

		grep -i $item .git/rebase-merge/author-script >tmp &&
		cat tmp >>.git/rebase-merge/author-script &&

		check_resolve_fails
	'
done

test_expect_success 'unknown key in author-script' '
	create_conflict &&

	echo "GIT_AUTHOR_BOGUS=${SQ}whatever${SQ}" \
		>>.git/rebase-merge/author-script &&

	check_resolve_fails
'

test_done