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
t4102-apply-rename.sh
#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#

test_description='git apply handling copy/rename patch.

'
. ./test-lib.sh

# setup

cat >test-patch <<\EOF
diff --git a/foo b/bar
similarity index 47%
rename from foo
rename to bar
--- a/foo
+++ b/bar
@@ -1 +1 @@
-This is foo
+This is bar
EOF

echo 'This is foo' >foo
chmod +x foo

test_expect_success setup \
    'git update-index --add foo'

test_expect_success apply \
    'git apply --index --stat --summary --apply test-patch'

test_expect_success FILEMODE validate \
	    'test -f bar && ls -l bar | grep "^-..x......"'

test_expect_success 'apply reverse' \
    'git apply -R --index --stat --summary --apply test-patch &&
     test "$(cat foo)" = "This is foo"'

cat >test-patch <<\EOF
diff --git a/foo b/bar
similarity index 47%
copy from foo
copy to bar
--- a/foo
+++ b/bar
@@ -1 +1 @@
-This is foo
+This is bar
EOF

test_expect_success 'apply copy' \
    'git apply --index --stat --summary --apply test-patch &&
     test "$(cat bar)" = "This is bar" && test "$(cat foo)" = "This is foo"'

test_done
back to top