summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-03-16 15:16:52 +0100
committernulltoken <emeric.fermas@gmail.com>2012-03-16 15:16:52 +0100
commit7b93079b5b7c5f58de321bb9846e93b1717d3e4c (patch)
treea57958a3f68e326fe657aacd3e63c39ac725a9d9 /src/path.c
parente24fbba94862fdb602846771f2ae41ef15834d10 (diff)
downloadlibgit2-7b93079b5b7c5f58de321bb9846e93b1717d3e4c.tar.gz
Make git_path_root() cope with windows network paths
Fix libgit2/libgit2sharp#125
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c
index 0f45d7130..45cc94e82 100644
--- a/src/path.c
+++ b/src/path.c
@@ -171,6 +171,15 @@ int git_path_root(const char *path)
/* Does the root of the path look like a windows drive ? */
if (isalpha(path[0]) && (path[1] == ':'))
offset += 2;
+
+ /* Are we dealing with a network path? */
+ else if (path[0] == '/' && path[1] == '/') {
+ offset += 2;
+
+ /* Skip the computer name segment */
+ while (*(path + offset) && *(path + offset) != '/')
+ offset++;
+ }
#endif
if (*(path + offset) == '/')