diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-07-13 17:11:19 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-07-13 17:11:19 +0200 |
commit | a58854a0311316a66fda363e83665ab942d81ec6 (patch) | |
tree | eb12a3f0b1e99c55fb7f53eefdd48d5161eca928 /src/path.c | |
parent | f00f005bad3d27bb5c23ae5d7187622b940c5d0e (diff) | |
download | libgit2-cmn/submodule-backslash.tar.gz |
submodule, path: extract slash conversioncmn/submodule-backslash
Extract the backslash-to-slash conversion into a helper function.
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c index 2558058dd..16283cab2 100644 --- a/src/path.c +++ b/src/path.c @@ -1671,3 +1671,19 @@ bool git_path_isvalid( return verify_component(repo, start, (c - start), flags); } + +int git_path_normalize_slashes(git_buf *out, const char *path) +{ + int error; + char *p; + + if ((error = git_buf_puts(out, path)) < 0) + return error; + + for (p = out->ptr; *p; p++) { + if (*p == '\\') + *p = '/'; + } + + return 0; +} |