summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-06-03 22:10:34 +0200
committerVicent Marti <vicent@github.com>2014-06-03 22:10:34 +0200
commit90befde4a1938641dfdb9a7bdb9f361d1de5c26f (patch)
tree368139171b8233f5f45acaf62fa53b2f6ce8a376 /src/path.c
parentdfcba09e671048668ce55e1efef9f8cf40e4e4a2 (diff)
parent18d7896cb00b9a4abe55cb461e12db4813e6a59e (diff)
downloadlibgit2-90befde4a1938641dfdb9a7bdb9f361d1de5c26f.tar.gz
Merge pull request #2399 from libgit2/cmn/path-to-path
clone: re-use the local transport's path resolution
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c
index e0b00a086..5beab97ed 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1127,3 +1127,21 @@ int git_path_dirload_with_stat(
return error;
}
+
+int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or_path)
+{
+ int error;
+
+ /* If url_or_path begins with file:// treat it as a URL */
+ if (!git__prefixcmp(url_or_path, "file://")) {
+ if ((error = git_path_fromurl(local_path_out, url_or_path)) < 0) {
+ return error;
+ }
+ } else { /* We assume url_or_path is already a path */
+ if ((error = git_buf_sets(local_path_out, url_or_path)) < 0) {
+ return error;
+ }
+ }
+
+ return 0;
+}