From df60f738f472c484c73944d067b707d9aad93b11 Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 1 Jul 2020 10:19:18 +0200 Subject: [PATCH] git: Update repository HEAD in create_branch(). --- src/git.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/git.cpp b/src/git.cpp index 654644f..59be8e7 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -113,6 +113,7 @@ void create_branch() { const auto id{get_last_id() + 1}; const string branch_name = "web-" + std::to_string(id); + const string ref_name{"refs/heads/" + branch_name}; git_oid oid_parent; git_commit *commit; @@ -125,6 +126,8 @@ void create_branch() git_reference *branch; // Create new branch. check(git_branch_create(&branch, _repo, branch_name.c_str(), commit, 0)); + + check(git_repository_set_head(_repo, ref_name.c_str())); } void commit(const entry_type &entry)