#!/bin/sh global test_description := ''test case insensitive pathspec limiting'' source ./test-lib.sh if test_have_prereq CASE_INSENSITIVE_FS { global skip_all := ''skipping case sensitive tests - case insensitive file system'' test_done } 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 (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test case insensitive pathspec limiting">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (If arms: [ (if_arm cond: [(C {(test_have_prereq)} {(CASE_INSENSITIVE_FS)})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(SQ <"skipping case sensitive tests - case insensitive file system">)} spids: [23] ) ] spids: [23] ) (C {(test_done)}) ] spids: [-1 20] ) ] spids: [-1 31] ) (C {(test_expect_success)} {(SQ <"create commits with glob characters">)} { (SQ <"\n"> <"\ttest_commit bar bar &&\n"> <"\ttest_commit bAr bAr &&\n"> <"\ttest_commit BAR BAR &&\n"> <"\tmkdir foo &&\n"> <"\ttest_commit foo/bar foo/bar &&\n"> <"\ttest_commit foo/bAr foo/bAr &&\n"> <"\ttest_commit foo/BAR foo/BAR &&\n"> <"\tmkdir fOo &&\n"> <"\ttest_commit fOo/bar fOo/bar &&\n"> <"\ttest_commit fOo/bAr fOo/bAr &&\n"> <"\ttest_commit fOo/BAR fOo/BAR &&\n"> <"\tmkdir FOO &&\n"> <"\ttest_commit FOO/bar FOO/bar &&\n"> <"\ttest_commit FOO/bAr FOO/bAr &&\n"> <"\ttest_commit FOO/BAR FOO/BAR\n"> ) } ) (C {(test_expect_success)} {(SQ <"tree_entry_interesting matches bar">)} { (SQ <"\n"> <"\techo bar >expect &&\n"> <"\tgit log --format=%s -- \"bar\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"tree_entry_interesting matches :(icase)bar">)} { (SQ <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\tBAR\n"> <"\tbAr\n"> <"\tbar\n"> <"\tEOF\n"> <"\tgit log --format=%s -- \":(icase)bar\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"tree_entry_interesting matches :(icase)bar with prefix">)} { (SQ <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\tfOo/BAR\n"> <"\tfOo/bAr\n"> <"\tfOo/bar\n"> <"\tEOF\n"> <"\t( cd fOo && git log --format=%s -- \":(icase)bar\" ) >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"tree_entry_interesting matches :(icase)bar with empty prefix">)} { (SQ <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\tFOO/BAR\n"> <"\tFOO/bAr\n"> <"\tFOO/bar\n"> <"\tfOo/BAR\n"> <"\tfOo/bAr\n"> <"\tfOo/bar\n"> <"\tfoo/BAR\n"> <"\tfoo/bAr\n"> <"\tfoo/bar\n"> <"\tEOF\n"> <"\t( cd fOo && git log --format=%s -- \":(icase)../foo/bar\" ) >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"match_pathspec matches :(icase)bar">)} { (SQ <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\tBAR\n"> <"\tbAr\n"> <"\tbar\n"> <"\tEOF\n"> <"\tgit ls-files \":(icase)bar\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"match_pathspec matches :(icase)bar with prefix">)} { (SQ <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\tfOo/BAR\n"> <"\tfOo/bAr\n"> <"\tfOo/bar\n"> <"\tEOF\n"> <"\t( cd fOo && git ls-files --full-name \":(icase)bar\" ) >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"match_pathspec matches :(icase)bar with empty prefix">)} { (SQ <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\tbar\n"> <"\tfOo/BAR\n"> <"\tfOo/bAr\n"> <"\tfOo/bar\n"> <"\tEOF\n"> <"\t( cd fOo && git ls-files --full-name \":(icase)bar\" ../bar ) >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"\"git diff\" can take magic :(icase) pathspec">)} { (SQ <"\n"> <"\techo FOO/BAR >expect &&\n"> <"\tgit diff --name-only HEAD^ HEAD -- \":(icase)foo/bar\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_done)}) ] )