summaryrefslogtreecommitdiff
path: root/t/t7525-status-rename.sh
blob: ef8b1b307851084308b1d8553c41c5e9dc61b836 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
 
test_description='git status rename detection options'
 
. ./test-lib.sh
 
test_expect_success 'setup' '
	echo 1 >original &&
	git add . &&
	git commit -m"Adding original file." &&
	mv original renamed &&
	echo 2 >> renamed &&
	git add . &&
	cat >.gitignore <<-\EOF
	.gitignore
	expect*
	actual*
	EOF
'
 
test_expect_success 'status no-options' '
	git status >actual &&
	test_i18ngrep "renamed:" actual
'
 
test_expect_success 'status --no-renames' '
	git status --no-renames >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual
'
 
test_expect_success 'status.renames inherits from diff.renames false' '
	git -c diff.renames=false status >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual
'
 
test_expect_success 'status.renames inherits from diff.renames true' '
	git -c diff.renames=true status >actual &&
	test_i18ngrep "renamed:" actual
'
 
test_expect_success 'status.renames overrides diff.renames false' '
	git -c diff.renames=true -c status.renames=false status >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual
'
 
test_expect_success 'status.renames overrides from diff.renames true' '
	git -c diff.renames=false -c status.renames=true status >actual &&
	test_i18ngrep "renamed:" actual
'
 
test_expect_success 'status status.renames=false' '
	git -c status.renames=false status >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual
'
 
test_expect_success 'status status.renames=true' '
	git -c status.renames=true status >actual &&
	test_i18ngrep "renamed:" actual
'
 
test_expect_success 'commit honors status.renames=false' '
	git -c status.renames=false commit --dry-run >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual
'
 
test_expect_success 'commit honors status.renames=true' '
	git -c status.renames=true commit --dry-run >actual &&
	test_i18ngrep "renamed:" actual
'
 
test_expect_success 'status config overridden' '
	git -c status.renames=true status --no-renames >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual
'
 
test_expect_success 'status score=100%' '
	git status -M=100% >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual &&
 
	git status --find-rename=100% >actual &&
	test_i18ngrep "deleted:" actual &&
	test_i18ngrep "new file:" actual
'
 
test_expect_success 'status score=01%' '
	git status -M=01% >actual &&
	test_i18ngrep "renamed:" actual &&
 
	git status --find-rename=01% >actual &&
	test_i18ngrep "renamed:" actual
'
 
test_expect_success 'copies not overridden by find-rename' '
	cp renamed copy &&
	git add copy &&
 
	git -c status.renames=copies status -M=01% >actual &&
	test_i18ngrep "copied:" actual &&
	test_i18ngrep "renamed:" actual &&
 
	git -c status.renames=copies status --find-rename=01% >actual &&
	test_i18ngrep "copied:" actual &&
	test_i18ngrep "renamed:" actual
'
 
test_done