[PATCH 08/10] t2200, t7004: Avoid glob pattern that also matches files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Windows, there is an unfortunate interaction between the MSYS bash and
git's command line processing:

- Since Windows's CMD does not do the wildcard expansion, but passes
  arguments like path* through to the programs, the programs must do the
  expansion themselves. This happens in the startup code before main() is
  entered.

- bash, however, passes the argument "path*" to git, assuming that git will
  see the unquoted word unchanged as a single argument.

But actually git expands the unquoted word before main() is entered.

In t2200, not all names that the test case is interested in exist as files
at the time when 'git ls-files' is invoked. git expands "path?" to only
the subset of files the exist, and only that subset was listed, so that the
test failed.  We now list all interesting paths explicitly.

In t7004, git exanded the pattern "*a*" to "actual" (the file that stdout
was redirected to), which is not what the was tested for. We fix it by
renaming the output file (and removing any existing files matching *a*).
This was originally fixed by Johannes Schindelin.

Signed-off-by: Johannes Sixt <j6t@xxxxxxxx>
---
 t/t2200-add-update.sh |    2 +-
 t/t7004-tag.sh        |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index b2ddf5a..652801e 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
@@ -150,7 +150,7 @@ test_expect_success 'add -u resolves unmerged paths' '
 	echo 2 >path3 &&
 	echo 2 >path5 &&
 	git add -u &&
-	git ls-files -s "path?" >actual &&
+	git ls-files -s path1 path3 path4 path5 path6 >actual &&
 	{
 		echo "100644 $three 0	path1"
 		echo "100644 $one 1	path3"
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 06e6e17..1c27ffb 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -185,8 +185,9 @@ cba
 EOF
 test_expect_success \
 	'listing tags with substring as pattern must print those matching' '
-	git tag -l "*a*" > actual &&
-	test_cmp expect actual
+	rm *a* &&
+	git tag -l "*a*" > current &&
+	test_cmp expect current
 '
 
 cat >expect <<EOF
-- 
1.6.2.1.224.g2225f

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux