Skip to content

Commit 74af95d

Browse files
ienorandgitster
authored andcommitted
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 <[email protected]> Reviewed-by: Duy Nguyen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f02033f commit 74af95d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

t/t0060-path-utils.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
190190
test "$sym" = "$(test-path-utils real_path "$dir2/syml")"
191191
'
192192

193+
test_expect_failure SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' '
194+
ln -s target symlink &&
195+
test "$(test-path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
196+
'
197+
193198
relative_path /foo/a/b/c/ /foo/a/b/ c/
194199
relative_path /foo/a/b/c/ /foo/a/b c/
195200
relative_path /foo/a//b//c/ ///foo/a/b// c/ POSIX

0 commit comments

Comments
 (0)