diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-01-06 11:42:07 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-06 11:42:07 +0400 |
commit | 971e829cd84cf95203cec44d22d0e009f98ddbf5 (patch) | |
tree | cb444c4dec360e625709b3a1db91d1e99acf9197 /t | |
parent | 29fb15152584455590905726cb5a0e26ea26e9eb (diff) | |
parent | 823ab40fd4adc5bf5b5c66b6d189deae34d2a138 (diff) |
Merge branch 'jk/pathspec-literal'
Allow scripts to feed literal paths to commands that take
pathspecs, by disabling wildcard globbing.
* jk/pathspec-literal:
add global --literal-pathspecs option
Conflicts:
dir.c
Diffstat (limited to 't')
-rwxr-xr-x | t/t6130-pathspec-noglob.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/t/t6130-pathspec-noglob.sh b/t/t6130-pathspec-noglob.sh new file mode 100755 index 0000000000..bb5e710054 --- /dev/null +++ b/t/t6130-pathspec-noglob.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +test_description='test globbing (and noglob) of pathspec limiting' +. ./test-lib.sh + +test_expect_success 'create commits with glob characters' ' + test_commit unrelated bar && + test_commit vanilla foo && + test_commit star "f*" && + test_commit bracket "f[o][o]" +' + +test_expect_success 'vanilla pathspec matches literally' ' + echo vanilla >expect && + git log --format=%s -- foo >actual && + test_cmp expect actual +' + +test_expect_success 'star pathspec globs' ' + cat >expect <<-\EOF && + bracket + star + vanilla + EOF + git log --format=%s -- "f*" >actual && + test_cmp expect actual +' + +test_expect_success 'bracket pathspec globs and matches literal brackets' ' + cat >expect <<-\EOF && + bracket + vanilla + EOF + git log --format=%s -- "f[o][o]" >actual && + test_cmp expect actual +' + +test_expect_success 'no-glob option matches literally (vanilla)' ' + echo vanilla >expect && + git --literal-pathspecs log --format=%s -- foo >actual && + test_cmp expect actual +' + +test_expect_success 'no-glob option matches literally (star)' ' + echo star >expect && + git --literal-pathspecs log --format=%s -- "f*" >actual && + test_cmp expect actual +' + +test_expect_success 'no-glob option matches literally (bracket)' ' + echo bracket >expect && + git --literal-pathspecs log --format=%s -- "f[o][o]" >actual && + test_cmp expect actual +' + +test_expect_success 'no-glob environment variable works' ' + echo star >expect && + GIT_LITERAL_PATHSPECS=1 git log --format=%s -- "f*" >actual && + test_cmp expect actual +' + +test_done |