mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 12:57:05 +00:00
A missing refspec is not an error
It's rare for a configured remote, but for one given as an URL on the command line, it's more often than not the case. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
This commit is contained in:
parent
cd19ca9584
commit
4a3b18a62f
10
src/fetch.c
10
src/fetch.c
@ -36,11 +36,13 @@ static int filter_wants(git_remote *remote)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The fetch refspec can be NULL, and what this means is that the
|
||||||
|
* user didn't specify one. This is fine, as it means that we're
|
||||||
|
* not interested in any particular branch but just the remote's
|
||||||
|
* HEAD, which will be stored in FETCH_HEAD after the fetch.
|
||||||
|
*/
|
||||||
spec = git_remote_fetchspec(remote);
|
spec = git_remote_fetchspec(remote);
|
||||||
if (spec == NULL) {
|
|
||||||
error = git__throw(GIT_ERROR, "The remote has no fetchspec");
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < refs.len; ++i) {
|
for (i = 0; i < refs.len; ++i) {
|
||||||
git_remote_head *head = refs.heads[i];
|
git_remote_head *head = refs.heads[i];
|
||||||
|
@ -42,17 +42,17 @@ int git_refspec_parse(git_refspec *refspec, const char *str)
|
|||||||
|
|
||||||
const char *git_refspec_src(const git_refspec *refspec)
|
const char *git_refspec_src(const git_refspec *refspec)
|
||||||
{
|
{
|
||||||
return refspec->src;
|
return refspec == NULL ? NULL : refspec->src;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *git_refspec_dst(const git_refspec *refspec)
|
const char *git_refspec_dst(const git_refspec *refspec)
|
||||||
{
|
{
|
||||||
return refspec->dst;
|
return refspec == NULL ? NULL : refspec->dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_refspec_src_match(const git_refspec *refspec, const char *refname)
|
int git_refspec_src_match(const git_refspec *refspec, const char *refname)
|
||||||
{
|
{
|
||||||
return git__fnmatch(refspec->src, refname, 0);
|
return refspec == NULL ? GIT_ENOMATCH : git__fnmatch(refspec->src, refname, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, const char *name)
|
int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, const char *name)
|
||||||
|
Loading…
Reference in New Issue
Block a user