Revision 89a70b80ebabd237bb407f9321f24677f4f1d16d authored by Johannes Schindelin on 03 January 2018, 16:54:54 UTC, committed by Junio C Hamano on 03 January 2018, 23:55:50 UTC
When cleaning up files in the $HOME directory, it really makes sense to
quote the path, especially in Git's test suite, where the HOME directory
is *guaranteed* to contain spaces in its name.

It would appear that those two tests pass even without cleaning up the
files, but really more by pure chance than by design (the cleanup seems
not actually to be necessary).

However, if anybody would have a left-over `trash/` directory in Git's
`t/` directory, these tests would fail, because they would all of a
sudden try to delete that directory, but without the `-r` (recursive)
flag. That is how this issue was found.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 567c53d
Raw File
t3703-add-magic-pathspec.sh
#!/bin/sh

test_description='magic pathspec tests using git-add'

. ./test-lib.sh

test_expect_success 'setup' '
	mkdir sub anothersub &&
	: >sub/foo &&
	: >anothersub/foo
'

test_expect_success 'add :/' "
	cat >expected <<-EOF &&
	add 'anothersub/foo'
	add 'expected'
	add 'sub/actual'
	add 'sub/foo'
	EOF
	(cd sub && git add -n :/ >actual) &&
	test_cmp expected sub/actual
"

cat >expected <<EOF
add 'anothersub/foo'
EOF

test_expect_success 'add :/anothersub' '
	(cd sub && git add -n :/anothersub >actual) &&
	test_cmp expected sub/actual
'

test_expect_success 'add :/non-existent' '
	(cd sub && test_must_fail git add -n :/non-existent)
'

cat >expected <<EOF
add 'sub/foo'
EOF

if test_have_prereq !MINGW && mkdir ":" 2>/dev/null
then
	test_set_prereq COLON_DIR
fi

test_expect_success COLON_DIR 'a file with the same (long) magic name exists' '
	: >":(icase)ha" &&
	test_must_fail git add -n ":(icase)ha" &&
	git add -n "./:(icase)ha"
'

test_expect_success COLON_DIR 'a file with the same (short) magic name exists' '
	: >":/bar" &&
	test_must_fail git add -n :/bar &&
	git add -n "./:/bar"
'

test_done
back to top