diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2015-07-24 15:05:16 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-07-24 15:05:16 -0500 |
| commit | 2dfd5eae33e079bc92a15ccfd561901ea7b69e45 (patch) | |
| tree | 9ffd9710483898fa66ac9da05159b1264b147032 /src/submodule.c | |
| parent | 759b2230a522df47640808cb0b21346cc824f6ff (diff) | |
| parent | a58854a0311316a66fda363e83665ab942d81ec6 (diff) | |
| download | libgit2-2dfd5eae33e079bc92a15ccfd561901ea7b69e45.tar.gz | |
Merge pull request #3307 from libgit2/cmn/submodule-backslash
Normalize submodule urls before looking at them
Diffstat (limited to 'src/submodule.c')
| -rw-r--r-- | src/submodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/submodule.c b/src/submodule.c index 892c98304..991ebc8f3 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -781,11 +781,21 @@ const char *git_submodule_url(git_submodule *submodule) int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *url) { int error = 0; + git_buf normalized = GIT_BUF_INIT; assert(out && repo && url); git_buf_sanitize(out); + /* We do this in all platforms in case someone on Windows created the .gitmodules */ + if (strchr(url, '\\')) { + if ((error = git_path_normalize_slashes(&normalized, url)) < 0) + return error; + + url = normalized.ptr; + } + + if (git_path_is_relative(url)) { if (!(error = get_url_base(out, repo))) error = git_path_apply_relative(out, url); @@ -796,6 +806,7 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur error = -1; } + git_buf_free(&normalized); return error; } |
