summaryrefslogtreecommitdiff
path: root/t/t0000-basic.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-08-01 01:28:59 +0100
committerJunio C Hamano <gitster@pobox.com>2007-08-01 00:38:30 -0700
commite5392c51469c25851f9c6e53165d75fc61901768 (patch)
tree9fc9e6a7b22c40694e5bb6994c599da1a159d96e /t/t0000-basic.sh
parent73a7a65663223d08d8cabac8d873de21b7e9678d (diff)
downloadgit-e5392c51469c25851f9c6e53165d75fc61901768.tar.gz
Add is_absolute_path() and make_absolute_path()
This patch adds convenience functions to work with absolute paths. The function is_absolute_path() should help the efforts to integrate the MinGW fork. Note that make_absolute_path() returns a pointer to a static buffer. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0000-basic.sh')
-rwxr-xr-xt/t0000-basic.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 4bba9c0717..4e49d59065 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -281,4 +281,20 @@ test_expect_success 'update-index D/F conflict' '
test $numpath0 = 1
'
+test_expect_success 'absolute path works as expected' '
+ mkdir first &&
+ ln -s ../.git first/.git &&
+ mkdir second &&
+ ln -s ../first second/other &&
+ mkdir third &&
+ dir="$(cd .git; pwd -P)" &&
+ dir2=third/../second/other/.git &&
+ test "$dir" = "$(test-absolute-path $dir2)" &&
+ file="$dir"/index &&
+ test "$file" = "$(test-absolute-path $dir2/index)" &&
+ ln -s ../first/file .git/syml &&
+ sym="$(cd first; pwd -P)"/file &&
+ test "$sym" = "$(test-absolute-path $dir2/syml)"
+'
+
test_done