diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2012-06-13 23:28:51 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2012-06-13 23:28:51 +0100 |
commit | a21bb1aa33e9887c06852db62526895df6091736 (patch) | |
tree | 6e05069971f04fb91f36d91818f78a62de93c1b1 /src/path.c | |
parent | 96ef3d84629ef72fb662d95abbab3de634921678 (diff) | |
parent | 86ea6ceda75274621b7d5c3023c5b04da3ab677e (diff) | |
download | libgit2-a21bb1aa33e9887c06852db62526895df6091736.tar.gz |
Merge remote-tracking branch 'source/development' into development
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/path.c b/src/path.c index 596dad164..d48435bd8 100644 --- a/src/path.c +++ b/src/path.c @@ -17,6 +17,10 @@ #include <stdio.h> #include <ctype.h> +#ifdef GIT_WIN32 +#define LOOKS_LIKE_DRIVE_PREFIX(S) (git__isalpha((S)[0]) && (S)[1] == ':') +#endif + /* * Based on the Android implementation, BSD licensed. * Check http://android.git.kernel.org/ @@ -105,7 +109,7 @@ int git_path_dirname_r(git_buf *buffer, const char *path) /* Mimic unix behavior where '/.git' returns '/': 'C:/.git' will return 'C:/' here */ - if (len == 2 && isalpha(path[0]) && path[1] == ':') { + if (len == 2 && LOOKS_LIKE_DRIVE_PREFIX(path)) { len = 3; goto Exit; } @@ -170,7 +174,7 @@ int git_path_root(const char *path) #ifdef GIT_WIN32 /* Does the root of the path look like a windows drive ? */ - if (isalpha(path[0]) && (path[1] == ':')) + if (LOOKS_LIKE_DRIVE_PREFIX(path)) offset += 2; /* Are we dealing with a windows network path? */ @@ -210,7 +214,7 @@ int git_path_prettify(git_buf *path_out, const char *path, const char *base) giterr_set(GITERR_OS, "Failed to resolve path '%s'", path); git_buf_clear(path_out); - + return error; } |