X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7300-clean.sh;h=afccfc9973ba864167387b1e1caf6fe8b12f68f9;hb=1eaa541f5fbda3fc30085da4f75e99dfae4ec9b3;hp=4037142927ab1b255da90d8f08207841b4e4c993;hpb=832d586a0cb30e6568810709c183ad516a8548a3;p=git.git diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 403714292..afccfc997 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -89,6 +89,58 @@ test_expect_success 'git-clean with prefix' ' test -f build/lib.so ' + +test_expect_success 'git-clean with relative prefix' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + would_clean=$( + cd docs && + git clean -n ../src | + sed -n -e "s|^Would remove ||p" + ) && + test "$would_clean" = ../src/part3.c || { + echo "OOps <$would_clean>" + false + } +' + +test_expect_success 'git-clean with absolute path' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + would_clean=$( + cd docs && + git clean -n $(pwd)/../src | + sed -n -e "s|^Would remove ||p" + ) && + test "$would_clean" = ../src/part3.c || { + echo "OOps <$would_clean>" + false + } +' + +test_expect_success 'git-clean with out of work tree relative path' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + ( + cd docs && + test_must_fail git clean -n ../.. + ) +' + +test_expect_success 'git-clean with out of work tree absolute path' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + dd=$(cd .. && pwd) && + ( + cd docs && + test_must_fail git clean -n $dd + ) +' + test_expect_success 'git-clean -d with prefix and path' ' mkdir -p build docs src/feature &&