mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-23 12:05:21 +00:00
Fix local push to file:// URL.
This commit is contained in:
parent
b6815fe0d5
commit
4e974c971f
@ -344,11 +344,29 @@ static int local_push(
|
|||||||
git_repository *remote_repo = NULL;
|
git_repository *remote_repo = NULL;
|
||||||
push_spec *spec;
|
push_spec *spec;
|
||||||
char *url = NULL;
|
char *url = NULL;
|
||||||
|
const char *path;
|
||||||
|
git_buf buf = GIT_BUF_INIT;
|
||||||
int error;
|
int error;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
if ((error = git_repository_open(&remote_repo, push->remote->url)) < 0)
|
/* The repo layer doesn't want the prefix */
|
||||||
|
if (!git__prefixcmp(push->remote->url, "file://")) {
|
||||||
|
if (git_path_fromurl(&buf, push->remote->url) < 0) {
|
||||||
|
git_buf_free(&buf);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
path = git_buf_cstr(&buf);
|
||||||
|
|
||||||
|
} else { /* We assume push->remote->url is already a path */
|
||||||
|
path = push->remote->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = git_repository_open(&remote_repo, path);
|
||||||
|
|
||||||
|
git_buf_free(&buf);
|
||||||
|
|
||||||
|
if (error < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
/* We don't currently support pushing locally to non-bare repos. Proper
|
/* We don't currently support pushing locally to non-bare repos. Proper
|
||||||
|
Loading…
Reference in New Issue
Block a user