From c8bae7493d2f2910b57f13ded012e86bdcfb0532 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 16:47:53 +0200 Subject: Adding upstream version 1:2.39.2. Signed-off-by: Daniel Baumann --- t/t3703-add-magic-pathspec.sh | 59 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 t/t3703-add-magic-pathspec.sh (limited to 't/t3703-add-magic-pathspec.sh') diff --git a/t/t3703-add-magic-pathspec.sh b/t/t3703-add-magic-pathspec.sh new file mode 100755 index 0000000..d840710 --- /dev/null +++ b/t/t3703-add-magic-pathspec.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +test_description='magic pathspec tests using git-add' + +TEST_PASSES_SANITIZE_LEAK=true +. ./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 <actual) && + test_cmp expected sub/actual +' + +test_expect_success 'add :/non-existent' ' + (cd sub && test_must_fail git add -n :/non-existent) +' + +cat >expected </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 -- cgit v1.2.3