From 6bfb990dc74c3749b356f82f7c9744b43fe90ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 7 Jan 2015 14:47:02 +0000 Subject: 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. --- src/clone.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/clone.c') 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) -- cgit v1.2.1