t0060: add test for prefix_path when path == work tree
The current behaviour of prefix_path is to return an empty string if prefixing and absolute path that only contains exactly the work tree. This behaviour is a potential regression point. 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>
Martin Erik Werner committed
Feb 4, 2014 at 15:25 UTC
e5aa1fc472696bfc337b3f128d45c1ef2aba394d
1 file changed
+6
t/t0060-path-utils.sh
+6
@@ -195,6 +195,12 @@ test_expect_failure SYMLINKS 'prefix_path works with absolute paths to work tree
195
test "$(test-path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
196
'
197
198
+test_expect_success 'prefix_path works with only absolute path to work tree' '
199
+ echo "" >expected &&
200
+ test-path-utils prefix_path prefix "$(pwd)" >actual &&
201
+ test_cmp expected actual
202
+'
203
+
204
relative_path /foo/a/b/c/ /foo/a/b/ c/
205
relative_path /foo/a/b/c/ /foo/a/b c/
206
relative_path /foo/a//b//c/ ///foo/a/b// c/ POSIX