diff options
author | Martin Erik Werner <martinerikwerner@gmail.com> | 2014-02-04 15:25:16 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-04 11:25:15 -0800 |
commit | 74af95d6aac03e1a1227c78d0d0ea8bbc2fa2b4d (patch) | |
tree | b20768e199b71f17ef1c6efff391bf641d1e02c9 | |
parent | f02033f1d02a55b32815a4702389e4d492f38bcc (diff) | |
download | git-74af95d6aac03e1a1227c78d0d0ea8bbc2fa2b4d.tar.gz |
t0060: add test for prefix_path on symlinks via absolute paths
When symlinks in the working tree are manipulated using the absolute
path, git dereferences them, and tries to manipulate the link target
instead.
This applies to most high-level commands but prefix_path is the common
denominator for all of them.
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>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | t/t0060-path-utils.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh index 07c10c8dca..0bba9887e9 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 |