Merge branch 'rs/convert-fix-utf-without-dash'
[git.git] / t / t6131-pathspec-icase.sh
blob39fc3f6769be1c41d76c6acbfcb780b823afe7e7
1 #!/bin/sh
3 test_description='test case insensitive pathspec limiting'
4 . ./test-lib.sh
6 if test_have_prereq CASE_INSENSITIVE_FS
7 then
8 skip_all='skipping case sensitive tests - case insensitive file system'
9 test_done
12 test_expect_success 'create commits with glob characters' '
13 test_commit bar bar &&
14 test_commit bAr bAr &&
15 test_commit BAR BAR &&
16 mkdir foo &&
17 test_commit foo/bar foo/bar &&
18 test_commit foo/bAr foo/bAr &&
19 test_commit foo/BAR foo/BAR &&
20 mkdir fOo &&
21 test_commit fOo/bar fOo/bar &&
22 test_commit fOo/bAr fOo/bAr &&
23 test_commit fOo/BAR fOo/BAR &&
24 mkdir FOO &&
25 test_commit FOO/bar FOO/bar &&
26 test_commit FOO/bAr FOO/bAr &&
27 test_commit FOO/BAR FOO/BAR
30 test_expect_success 'tree_entry_interesting matches bar' '
31 echo bar >expect &&
32 git log --format=%s -- "bar" >actual &&
33 test_cmp expect actual
36 test_expect_success 'tree_entry_interesting matches :(icase)bar' '
37 cat <<-EOF >expect &&
38 BAR
39 bAr
40 bar
41 EOF
42 git log --format=%s -- ":(icase)bar" >actual &&
43 test_cmp expect actual
46 test_expect_success 'tree_entry_interesting matches :(icase)bar with prefix' '
47 cat <<-EOF >expect &&
48 fOo/BAR
49 fOo/bAr
50 fOo/bar
51 EOF
52 ( cd fOo && git log --format=%s -- ":(icase)bar" ) >actual &&
53 test_cmp expect actual
56 test_expect_success 'tree_entry_interesting matches :(icase)bar with empty prefix' '
57 cat <<-EOF >expect &&
58 FOO/BAR
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 EOF
68 ( cd fOo && git log --format=%s -- ":(icase)../foo/bar" ) >actual &&
69 test_cmp expect actual
72 test_expect_success 'match_pathspec matches :(icase)bar' '
73 cat <<-EOF >expect &&
74 BAR
75 bAr
76 bar
77 EOF
78 git ls-files ":(icase)bar" >actual &&
79 test_cmp expect actual
82 test_expect_success 'match_pathspec matches :(icase)bar with prefix' '
83 cat <<-EOF >expect &&
84 fOo/BAR
85 fOo/bAr
86 fOo/bar
87 EOF
88 ( cd fOo && git ls-files --full-name ":(icase)bar" ) >actual &&
89 test_cmp expect actual
92 test_expect_success 'match_pathspec matches :(icase)bar with empty prefix' '
93 cat <<-EOF >expect &&
94 bar
95 fOo/BAR
96 fOo/bAr
97 fOo/bar
98 EOF
99 ( cd fOo && git ls-files --full-name ":(icase)bar" ../bar ) >actual &&
100 test_cmp expect actual
103 test_expect_success '"git diff" can take magic :(icase) pathspec' '
104 echo FOO/BAR >expect &&
105 git diff --name-only HEAD^ HEAD -- ":(icase)foo/bar" >actual &&
106 test_cmp expect actual
109 test_done