summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-07-24 15:05:16 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2015-07-24 15:05:16 -0500
commit2dfd5eae33e079bc92a15ccfd561901ea7b69e45 (patch)
tree9ffd9710483898fa66ac9da05159b1264b147032 /src/path.c
parent759b2230a522df47640808cb0b21346cc824f6ff (diff)
parenta58854a0311316a66fda363e83665ab942d81ec6 (diff)
downloadlibgit2-2dfd5eae33e079bc92a15ccfd561901ea7b69e45.tar.gz
Merge pull request #3307 from libgit2/cmn/submodule-backslash
Normalize submodule urls before looking at them
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c
index 3e63f06d4..8317aaaa7 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1676,3 +1676,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;
+}