[PATCH v4 1/4] t0060: Add test for manipulating symlinks via absolute paths
- From
Martin Erik Werner <martinerikwerner@gmail.com>
- Date
- Feb 2, 2014, 01:59 UTC
- Message-ID
- <1391306351-13237-2-git-send-email-martinerikwerner@gmail.com>
- In-Reply-To
- <1391306351-13237-1-git-send-email-martinerikwerner@gmail.com>
When symlinks in the working tree are manipulated using the absolute path, git dereferences them, and tries to manipulate the link target instead.
This is a regression introduced by 18e051a: setup: translate symlinks in filename when using absolute paths (which did not take symlinks in the work tree into consideration).
Add a known-breakage tests using the prefix_path function, which currently uses real_path, causing the dereference.
Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com> --- t/t0060-path-utils.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh index 07c10c8..0bba988 100755 --- a/t/t0060-path-utils.sh +++ b/t/t0060-path-utils.sh @@ -190,6 +190,11 @@ test_expect_success SYMLINKS 'real path works on symlinks' ' test "$sym" = "$(test-path-utils real_path "$dir2/syml")" ' +test_expect_failure SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' ' + ln -s target symlink && + test "$(test-path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink" +' + relative_path /foo/a/b/c/ /foo/a/b/ c/ relative_path /foo/a/b/c/ /foo/a/b c/ relative_path /foo/a//b//c/ ///foo/a/b// c/ POSIX
-- 1.8.5.2