test prerequisites: enumerate with commas
[gitweb.git] / t / t0060-path-utils.sh
index b8e92e1a2affe8a60caecc770db188e5090a29f0..c0143a0a70b7d3dc213b691aecea6b3fffbc5844 100755 (executable)
@@ -190,7 +190,7 @@ 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' '
+test_expect_success 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"
 '
@@ -201,6 +201,16 @@ test_expect_success 'prefix_path works with only absolute path to work tree' '
        test_cmp expected actual
 '
 
+test_expect_success 'prefix_path rejects absolute path to dir with same beginning as work tree' '
+       test_must_fail test-path-utils prefix_path prefix "$(pwd)a"
+'
+
+test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having  same beginning as work tree' '
+       git init repo &&
+       ln -s repo repolink &&
+       test "a" = "$(cd repo && test-path-utils prefix_path prefix "$(pwd)/../repolink/a")"
+'
+
 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