Git fork
1#!/bin/sh
2
3test_description='test case insensitive pathspec limiting'
4
5. ./test-lib.sh
6
7if test_have_prereq CASE_INSENSITIVE_FS
8then
9 skip_all='skipping case sensitive tests - case insensitive file system'
10 test_done
11fi
12
13test_expect_success 'create commits with glob characters' '
14 test_commit bar bar &&
15 test_commit bAr bAr &&
16 test_commit BAR BAR &&
17 mkdir foo &&
18 test_commit foo/bar foo/bar &&
19 test_commit foo/bAr foo/bAr &&
20 test_commit foo/BAR foo/BAR &&
21 mkdir fOo &&
22 test_commit fOo/bar fOo/bar &&
23 test_commit fOo/bAr fOo/bAr &&
24 test_commit fOo/BAR fOo/BAR &&
25 mkdir FOO &&
26 test_commit FOO/bar FOO/bar &&
27 test_commit FOO/bAr FOO/bAr &&
28 test_commit FOO/BAR FOO/BAR
29'
30
31test_expect_success 'tree_entry_interesting matches bar' '
32 echo bar >expect &&
33 git log --format=%s -- "bar" >actual &&
34 test_cmp expect actual
35'
36
37test_expect_success 'tree_entry_interesting matches :(icase)bar' '
38 cat <<-EOF >expect &&
39 BAR
40 bAr
41 bar
42 EOF
43 git log --format=%s -- ":(icase)bar" >actual &&
44 test_cmp expect actual
45'
46
47test_expect_success 'tree_entry_interesting matches :(icase)bar with prefix' '
48 cat <<-EOF >expect &&
49 fOo/BAR
50 fOo/bAr
51 fOo/bar
52 EOF
53 ( cd fOo && git log --format=%s -- ":(icase)bar" ) >actual &&
54 test_cmp expect actual
55'
56
57test_expect_success 'tree_entry_interesting matches :(icase)bar with empty prefix' '
58 cat <<-EOF >expect &&
59 FOO/BAR
60 FOO/bAr
61 FOO/bar
62 fOo/BAR
63 fOo/bAr
64 fOo/bar
65 foo/BAR
66 foo/bAr
67 foo/bar
68 EOF
69 ( cd fOo && git log --format=%s -- ":(icase)../foo/bar" ) >actual &&
70 test_cmp expect actual
71'
72
73test_expect_success 'match_pathspec matches :(icase)bar' '
74 cat <<-EOF >expect &&
75 BAR
76 bAr
77 bar
78 EOF
79 git ls-files ":(icase)bar" >actual &&
80 test_cmp expect actual
81'
82
83test_expect_success 'match_pathspec matches :(icase)bar with prefix' '
84 cat <<-EOF >expect &&
85 fOo/BAR
86 fOo/bAr
87 fOo/bar
88 EOF
89 ( cd fOo && git ls-files --full-name ":(icase)bar" ) >actual &&
90 test_cmp expect actual
91'
92
93test_expect_success 'match_pathspec matches :(icase)bar with empty prefix' '
94 cat <<-EOF >expect &&
95 bar
96 fOo/BAR
97 fOo/bAr
98 fOo/bar
99 EOF
100 ( cd fOo && git ls-files --full-name ":(icase)bar" ../bar ) >actual &&
101 test_cmp expect actual
102'
103
104test_expect_success '"git diff" can take magic :(icase) pathspec' '
105 echo FOO/BAR >expect &&
106 git diff --name-only HEAD^ HEAD -- ":(icase)foo/bar" >actual &&
107 test_cmp expect actual
108'
109
110test_done