From 0ca7ca3ef788a45293852a41c55040bc94607961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 9 Oct 2011 03:07:53 +0200 Subject: [PATCH] refspec: allow a simple branchname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A simple branchname as refspec is valid and we shouldn't throw an error when encountering one. Signed-off-by: Carlos Martín Nieto --- src/refspec.c | 9 +++++++-- 1 file 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)