summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Lambourg <lambourg@adacore.com>2011-09-02 13:00:27 +0200
committerJerome Lambourg <lambourg@adacore.com>2011-09-02 13:04:29 +0200
commit13bc2016b7aaa3d7d17337fe7737481c67b2cb8a (patch)
treebfdd3ecfe569dc5f865a6aee906a065ffe8f30df
parent52e50c1a80db56b91ce3d99bd546c07b7135f735 (diff)
downloadlibgit2-13bc2016b7aaa3d7d17337fe7737481c67b2cb8a.tar.gz
Fix for issue #387
-rw-r--r--src/path.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c
index 1f7a16679..374694432 100644
--- a/src/path.c
+++ b/src/path.c
@@ -96,6 +96,16 @@ int git_path_dirname_r(char *buffer, size_t bufflen, const char *path)
len = endp - path +1;
+#ifdef GIT_WIN32
+ /* Mimic unix behavior where '/.git' returns '/': 'C:/.git' will return
+ 'C:/' here */
+
+ if (len == 2 && isalpha(path[0]) && path[1] == ':') {
+ len = 3;
+ goto Exit;
+ }
+#endif
+
Exit:
result = len;
if (len+1 > GIT_PATH_MAX) {