summaryrefslogtreecommitdiff
path: root/src/refspec.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-10-03 22:26:06 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-10-08 02:12:26 +0200
commit4a3b18a62f99c836900c76d480ae33933098461c (patch)
tree1d4befdfaf88b0a13b1c79835b032f0de084fb73 /src/refspec.c
parentcd19ca9584bd01925e05e94e7f3bddae6880acda (diff)
downloadlibgit2-4a3b18a62f99c836900c76d480ae33933098461c.tar.gz
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>
Diffstat (limited to 'src/refspec.c')
-rw-r--r--src/refspec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/refspec.c b/src/refspec.c
index 9de273071..ed4b5e6b8 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -42,17 +42,17 @@ int git_refspec_parse(git_refspec *refspec, const char *str)
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)
{
- return refspec->dst;
+ return refspec == NULL ? NULL : refspec->dst;
}
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)