Nguyễn Thái Ngọc Duy | 93d9353 | 2013-07-14 15:36:09 +0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='test case insensitive pathspec limiting' |
| 4 | . ./test-lib.sh |
| 5 | |
Mark Levedahl | db6a6ad | 2013-07-17 09:22:16 -0400 | [diff] [blame] | 6 | if test_have_prereq CASE_INSENSITIVE_FS |
| 7 | then |
| 8 | skip_all='skipping case sensitive tests - case insensitive file system' |
| 9 | test_done |
| 10 | fi |
| 11 | |
Nguyễn Thái Ngọc Duy | 93d9353 | 2013-07-14 15:36:09 +0700 | [diff] [blame] | 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 |
| 28 | ' |
| 29 | |
| 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 |
| 34 | ' |
| 35 | |
| 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 |
| 44 | ' |
| 45 | |
| 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 |
| 54 | ' |
| 55 | |
| 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 |
| 70 | ' |
| 71 | |
Nguyễn Thái Ngọc Duy | 854b095 | 2014-01-24 20:40:30 +0700 | [diff] [blame] | 72 | test_expect_success 'match_pathspec matches :(icase)bar' ' |
Nguyễn Thái Ngọc Duy | 93d9353 | 2013-07-14 15:36:09 +0700 | [diff] [blame] | 73 | cat <<-EOF >expect && |
| 74 | BAR |
| 75 | bAr |
| 76 | bar |
| 77 | EOF |
| 78 | git ls-files ":(icase)bar" >actual && |
| 79 | test_cmp expect actual |
| 80 | ' |
| 81 | |
Nguyễn Thái Ngọc Duy | 854b095 | 2014-01-24 20:40:30 +0700 | [diff] [blame] | 82 | test_expect_success 'match_pathspec matches :(icase)bar with prefix' ' |
Nguyễn Thái Ngọc Duy | 93d9353 | 2013-07-14 15:36:09 +0700 | [diff] [blame] | 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 |
| 90 | ' |
| 91 | |
Nguyễn Thái Ngọc Duy | 854b095 | 2014-01-24 20:40:30 +0700 | [diff] [blame] | 92 | test_expect_success 'match_pathspec matches :(icase)bar with empty prefix' ' |
Nguyễn Thái Ngọc Duy | 93d9353 | 2013-07-14 15:36:09 +0700 | [diff] [blame] | 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 |
| 101 | ' |
| 102 | |
Nguyễn Thái Ngọc Duy | 887c6c1 | 2013-11-20 08:26:41 +0700 | [diff] [blame] | 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 |
| 107 | ' |
| 108 | |
Nguyễn Thái Ngọc Duy | 93d9353 | 2013-07-14 15:36:09 +0700 | [diff] [blame] | 109 | test_done |