diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2012-09-07 00:41:03 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-06 16:19:58 -0700 |
commit | f4c21e89d7c6b578140e90c02b40eccb51ab8428 (patch) | |
tree | 263d364a4ad03fd1def55d38d392f047224b511b /t | |
parent | t0060: verify that real_path() works correctly with absolute paths (diff) | |
download | tgif-f4c21e89d7c6b578140e90c02b40eccb51ab8428.tar.xz |
real_path(): properly handle nonexistent top-level paths
The change has two points:
1. Do not strip off a leading slash, because that erroneously turns an
absolute path into a relative path.
2. Do not remove slashes from groups of multiple slashes; instead let
chdir() handle them. It could be, for example, that it wants to
leave leading double-slashes alone.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t0060-path-utils.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh index 3121691c6f..30361f94a4 100755 --- a/t/t0060-path-utils.sh +++ b/t/t0060-path-utils.sh @@ -148,7 +148,7 @@ test_expect_success 'real path rejects the empty string' ' test_must_fail test-path-utils real_path "" ' -test_expect_failure POSIX 'real path works on absolute paths' ' +test_expect_success POSIX 'real path works on absolute paths' ' nopath="hopefully-absent-path" && test "/" = "$(test-path-utils real_path "/")" && test "/$nopath" = "$(test-path-utils real_path "/$nopath")" && |