summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b459b4)
raw | patch | inline | side by side (parent: 2b459b4)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sun, 2 Mar 2008 07:40:33 +0000 (07:40 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 2 Mar 2008 09:58:31 +0000 (01:58 -0800) |
When passing "xyz" to make_absolute_path(), make_absolute_path()
erroneously tried to chdir("xyz"), and then append "/xyz". Instead,
skip the chdir() completely when no slash was found.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
erroneously tried to chdir("xyz"), and then append "/xyz". Instead,
skip the chdir() completely when no slash was found.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
path.c | patch | blob | history | |
t/t0000-basic.sh | patch | blob | history |
index 42609524a55ad017557d48bedf26906cc4405d0a..af2716199b92e920df9fe2021035d319e8cafbc6 100644 (file)
--- a/path.c
+++ b/path.c
if (last_slash) {
*last_slash = '\0';
last_elem = xstrdup(last_slash + 1);
- } else
+ } else {
last_elem = xstrdup(buf);
+ *buf = '\0';
+ }
}
if (*buf) {
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 92de08822702f780c6895a5d2c070ee009ecfef7..27b54cbb1216beef8b5f315708574825a1c81da3 100755 (executable)
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
test "$dir" = "$(test-absolute-path $dir2)" &&
file="$dir"/index &&
test "$file" = "$(test-absolute-path $dir2/index)" &&
+ basename=blub &&
+ test "$dir/$basename" = $(cd .git && test-absolute-path $basename) &&
ln -s ../first/file .git/syml &&
sym="$(cd first; pwd -P)"/file &&
test "$sym" = "$(test-absolute-path $dir2/syml)"