2008-08-04 07:51:42 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2008-08-04 07:52:37 +00:00
|
|
|
test_description='update-index and add refuse to add beyond symlinks'
|
2008-08-04 07:51:42 +00:00
|
|
|
|
2021-10-12 13:56:37 +00:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2008-08-04 07:51:42 +00:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
2009-03-04 21:38:24 +00:00
|
|
|
test_expect_success SYMLINKS setup '
|
2008-08-04 07:51:42 +00:00
|
|
|
>a &&
|
|
|
|
mkdir b &&
|
|
|
|
ln -s b c &&
|
|
|
|
>c/d &&
|
|
|
|
git update-index --add a b/d
|
|
|
|
'
|
|
|
|
|
2009-03-04 21:38:24 +00:00
|
|
|
test_expect_success SYMLINKS 'update-index --add beyond symlinks' '
|
2008-08-04 07:51:42 +00:00
|
|
|
test_must_fail git update-index --add c/d &&
|
2023-02-06 22:44:32 +00:00
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
a
|
|
|
|
b/d
|
|
|
|
EOF
|
|
|
|
git ls-files >actual &&
|
|
|
|
test_cmp expect actual
|
2008-08-04 07:51:42 +00:00
|
|
|
'
|
|
|
|
|
2009-03-04 21:38:24 +00:00
|
|
|
test_expect_success SYMLINKS 'add beyond symlinks' '
|
2008-08-04 07:52:37 +00:00
|
|
|
test_must_fail git add c/d &&
|
2023-02-06 22:44:32 +00:00
|
|
|
cat >expect <<-\EOF &&
|
|
|
|
a
|
|
|
|
b/d
|
|
|
|
EOF
|
|
|
|
git ls-files >actual &&
|
|
|
|
test_cmp expect actual
|
2008-08-04 07:52:37 +00:00
|
|
|
'
|
|
|
|
|
2008-08-04 07:51:42 +00:00
|
|
|
test_done
|