summaryrefslogtreecommitdiff
path: root/src/clone.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-01-07 14:47:02 +0000
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-03 14:40:50 +0100
commit6bfb990dc74c3749b356f82f7c9744b43fe90ea9 (patch)
tree7b9acea4318400e209ce25ffed64df2e5b8ee654 /src/clone.c
parent23a17803b6e3a8bf21f740726ec0a038968da9a1 (diff)
downloadlibgit2-6bfb990dc74c3749b356f82f7c9744b43fe90ea9.tar.gz
branch: don't accept a reflog message override
This namespace is about behaving like git's branch command, so let's do exactly that instead of taking a reflog message. This override is still available via the reference namespace.
Diffstat (limited to 'src/clone.c')
-rw-r--r--src/clone.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/clone.c b/src/clone.c
index f7ae17c57..ac6a059dd 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -35,6 +35,7 @@ static int create_branch(
{
git_commit *head_obj = NULL;
git_reference *branch_ref = NULL;
+ git_buf refname = GIT_BUF_INIT;
int error;
/* Find the target commit */
@@ -42,8 +43,11 @@ static int create_branch(
return error;
/* Create the new branch */
- error = git_branch_create(&branch_ref, repo, name, head_obj, 0, log_message);
+ if ((error = git_buf_printf(&refname, GIT_REFS_HEADS_DIR "%s", name)) < 0)
+ return error;
+ error = git_reference_create(&branch_ref, repo, git_buf_cstr(&refname), target, 0, log_message);
+ git_buf_free(&refname);
git_commit_free(head_obj);
if (!error)