aboutsummaryrefslogtreecommitdiff
path: root/t/t6131-pathspec-icase.sh
blob: 39fc3f6769be1c41d76c6acbfcb780b823afe7e7 (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
#!/bin/sh

test_description='test case insensitive pathspec limiting'
. ./test-lib.sh

if test_have_prereq CASE_INSENSITIVE_FS
then
	skip_all='skipping case sensitive tests - case insensitive file system'
	test_done
fi

test_expect_success 'create commits with glob characters' '
	test_commit bar bar &&
	test_commit bAr bAr &&
	test_commit BAR BAR &&
	mkdir foo &&
	test_commit foo/bar foo/bar &&
	test_commit foo/bAr foo/bAr &&
	test_commit foo/BAR foo/BAR &&
	mkdir fOo &&
	test_commit fOo/bar fOo/bar &&
	test_commit fOo/bAr fOo/bAr &&
	test_commit fOo/BAR fOo/BAR &&
	mkdir FOO &&
	test_commit FOO/bar FOO/bar &&
	test_commit FOO/bAr FOO/bAr &&
	test_commit FOO/BAR FOO/BAR
'

test_expect_success 'tree_entry_interesting matches bar' '
	echo bar >expect &&
	git log --format=%s -- "bar" >actual &&
	test_cmp expect actual
'

test_expect_success 'tree_entry_interesting matches :(icase)bar' '
	cat <<-EOF >expect &&
	BAR
	bAr
	bar
	EOF
	git log --format=%s -- ":(icase)bar" >actual &&
	test_cmp expect actual
'

test_expect_success 'tree_entry_interesting matches :(icase)bar with prefix' '
	cat <<-EOF >expect &&
	fOo/BAR
	fOo/bAr
	fOo/bar
	EOF
	( cd fOo && git log --format=%s -- ":(icase)bar" ) >actual &&
	test_cmp expect actual
'

test_expect_success 'tree_entry_interesting matches :(icase)bar with empty prefix' '
	cat <<-EOF >expect &&
	FOO/BAR
	FOO/bAr
	FOO/bar
	fOo/BAR
	fOo/bAr
	fOo/bar
	foo/BAR
	foo/bAr
	foo/bar
	EOF
	( cd fOo && git log --format=%s -- ":(icase)../foo/bar" ) >actual &&
	test_cmp expect actual
'

test_expect_success 'match_pathspec matches :(icase)bar' '
	cat <<-EOF >expect &&
	BAR
	bAr
	bar
	EOF
	git ls-files ":(icase)bar" >actual &&
	test_cmp expect actual
'

test_expect_success 'match_pathspec matches :(icase)bar with prefix' '
	cat <<-EOF >expect &&
	fOo/BAR
	fOo/bAr
	fOo/bar
	EOF
	( cd fOo && git ls-files --full-name ":(icase)bar" ) >actual &&
	test_cmp expect actual
'

test_expect_success 'match_pathspec matches :(icase)bar with empty prefix' '
	cat <<-EOF >expect &&
	bar
	fOo/BAR
	fOo/bAr
	fOo/bar
	EOF
	( cd fOo && git ls-files --full-name ":(icase)bar" ../bar ) >actual &&
	test_cmp expect actual
'

test_expect_success '"git diff" can take magic :(icase) pathspec' '
	echo FOO/BAR >expect &&
	git diff --name-only HEAD^ HEAD -- ":(icase)foo/bar" >actual &&
	test_cmp expect actual
'

test_done