From f0096c06bcdeb7aa6ae8a749ddc9d6d4a2c381d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 25 Mar 2011 16:34:19 +0700 Subject: Convert read_tree{,_recursive} to support struct pathspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch changes behavior of the two functions. Previously it does prefix matching only. Now it can also do wildcard matching. All callers are updated. Some gain wildcard matching (archive, checkout), others reset pathspec_item.has_wildcard to retain old behavior (ls-files, ls-tree as they are plumbing). Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- t/t3102-ls-tree-wildcards.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 t/t3102-ls-tree-wildcards.sh (limited to 't/t3102-ls-tree-wildcards.sh') diff --git a/t/t3102-ls-tree-wildcards.sh b/t/t3102-ls-tree-wildcards.sh new file mode 100755 index 0000000000..f2b2a524d9 --- /dev/null +++ b/t/t3102-ls-tree-wildcards.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +test_description='ls-tree with(out) wildcards' + +. ./test-lib.sh + +test_expect_success 'setup' ' + mkdir a aa "a*" && + touch a/one aa/two "a*/three" && + git add a/one aa/two "a*/three" && + git commit -m test +' + +test_expect_success 'ls-tree a* matches literally' ' + cat >expected <actual && + test_cmp expected actual +' + +test_done -- cgit v1.2.3 From 145f86a00925b126412387c5ce072ab13cd4df03 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Thu, 12 May 2011 10:37:22 +0200 Subject: Tweak t3102-ls-tree-wildcards to run on Windows The test case fails on Windows, because "a*" is an invalid file name. Therefore, use "a[a]" instead. Signed-off-by: Johannes Sixt Acked-by: Nguyen Thai Ngoc Duy Signed-off-by: Junio C Hamano --- t/t3102-ls-tree-wildcards.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 't/t3102-ls-tree-wildcards.sh') diff --git a/t/t3102-ls-tree-wildcards.sh b/t/t3102-ls-tree-wildcards.sh index f2b2a524d9..c286854485 100755 --- a/t/t3102-ls-tree-wildcards.sh +++ b/t/t3102-ls-tree-wildcards.sh @@ -1,21 +1,21 @@ #!/bin/sh -test_description='ls-tree with(out) wildcards' +test_description='ls-tree with(out) globs' . ./test-lib.sh test_expect_success 'setup' ' - mkdir a aa "a*" && - touch a/one aa/two "a*/three" && - git add a/one aa/two "a*/three" && + mkdir a aa "a[a]" && + touch a/one aa/two "a[a]/three" && + git add a/one aa/two "a[a]/three" && git commit -m test ' -test_expect_success 'ls-tree a* matches literally' ' +test_expect_success 'ls-tree a[a] matches literally' ' cat >expected <actual && + git ls-tree -r HEAD "a[a]" >actual && test_cmp expected actual ' -- cgit v1.2.3