summaryrefslogtreecommitdiff
path: root/src/refspec.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-10-09 03:07:53 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-11-18 21:57:16 +0100
commit0ca7ca3ef788a45293852a41c55040bc94607961 (patch)
tree8d17ef2931ab8c836eab5ff9c01060c9f5f8ca44 /src/refspec.c
parentdc9e960f4be2e2fab10ecaeb5934c236ec729d9b (diff)
downloadlibgit2-0ca7ca3ef788a45293852a41c55040bc94607961.tar.gz
refspec: allow a simple branchname
A simple branchname as refspec is valid and we shouldn't throw an error when encountering one. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src/refspec.c')
-rw-r--r--src/refspec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/refspec.c b/src/refspec.c
index e60e8f5b5..62683e7b7 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -23,8 +23,13 @@ int git_refspec_parse(git_refspec *refspec, const char *str)
}
delim = strchr(str, ':');
- if (delim == NULL)
- return git__throw(GIT_EOBJCORRUPTED, "Failed to parse refspec. No ':'");
+ if (delim == NULL) {
+ refspec->src = git__strdup(str);
+ if (refspec->src == NULL)
+ return GIT_ENOMEM;
+
+ return GIT_SUCCESS;
+ }
refspec->src = git__strndup(str, delim - str);
if (refspec->src == NULL)