Merge branch 'js/var-git-shell-path'
[git/debian.git] / t / t6131-pathspec-icase.sh
blob770cce026cb158ab9a77eda336ff263c862fb0f8
1 #!/bin/sh
3 test_description='test case insensitive pathspec limiting'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 if test_have_prereq CASE_INSENSITIVE_FS
9 then
10 skip_all='skipping case sensitive tests - case insensitive file system'
11 test_done
14 test_expect_success 'create commits with glob characters' '
15 test_commit bar bar &&
16 test_commit bAr bAr &&
17 test_commit BAR BAR &&
18 mkdir foo &&
19 test_commit foo/bar foo/bar &&
20 test_commit foo/bAr foo/bAr &&
21 test_commit foo/BAR foo/BAR &&
22 mkdir fOo &&
23 test_commit fOo/bar fOo/bar &&
24 test_commit fOo/bAr fOo/bAr &&
25 test_commit fOo/BAR fOo/BAR &&
26 mkdir FOO &&
27 test_commit FOO/bar FOO/bar &&
28 test_commit FOO/bAr FOO/bAr &&
29 test_commit FOO/BAR FOO/BAR
32 test_expect_success 'tree_entry_interesting matches bar' '
33 echo bar >expect &&
34 git log --format=%s -- "bar" >actual &&
35 test_cmp expect actual
38 test_expect_success 'tree_entry_interesting matches :(icase)bar' '
39 cat <<-EOF >expect &&
40 BAR
41 bAr
42 bar
43 EOF
44 git log --format=%s -- ":(icase)bar" >actual &&
45 test_cmp expect actual
48 test_expect_success 'tree_entry_interesting matches :(icase)bar with prefix' '
49 cat <<-EOF >expect &&
50 fOo/BAR
51 fOo/bAr
52 fOo/bar
53 EOF
54 ( cd fOo && git log --format=%s -- ":(icase)bar" ) >actual &&
55 test_cmp expect actual
58 test_expect_success 'tree_entry_interesting matches :(icase)bar with empty prefix' '
59 cat <<-EOF >expect &&
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 foo/bar
69 EOF
70 ( cd fOo && git log --format=%s -- ":(icase)../foo/bar" ) >actual &&
71 test_cmp expect actual
74 test_expect_success 'match_pathspec matches :(icase)bar' '
75 cat <<-EOF >expect &&
76 BAR
77 bAr
78 bar
79 EOF
80 git ls-files ":(icase)bar" >actual &&
81 test_cmp expect actual
84 test_expect_success 'match_pathspec matches :(icase)bar with prefix' '
85 cat <<-EOF >expect &&
86 fOo/BAR
87 fOo/bAr
88 fOo/bar
89 EOF
90 ( cd fOo && git ls-files --full-name ":(icase)bar" ) >actual &&
91 test_cmp expect actual
94 test_expect_success 'match_pathspec matches :(icase)bar with empty prefix' '
95 cat <<-EOF >expect &&
96 bar
97 fOo/BAR
98 fOo/bAr
99 fOo/bar
101 ( cd fOo && git ls-files --full-name ":(icase)bar" ../bar ) >actual &&
102 test_cmp expect actual
105 test_expect_success '"git diff" can take magic :(icase) pathspec' '
106 echo FOO/BAR >expect &&
107 git diff --name-only HEAD^ HEAD -- ":(icase)foo/bar" >actual &&
108 test_cmp expect actual
111 test_done