From fee41f43bf9a7b5d2b50d1aee0c989205a79fd46 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 18 Jul 2023 11:34:48 -0400 Subject: [PATCH] fix: initial default branch name Use git plumbing to set the initial default branch name. Fixes: https://github.com/charmbracelet/soft-serve/issues/147 Fixes: https://github.com/charmbracelet/soft-serve/issues/260 --- server/git/git.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/git/git.go b/server/git/git.go index ef8affe207a0cf4993976cbcc28fe91e5e9d512f..f17cb37c8c5dde5a6d0e55d81afd2d76ff657731 100644 --- a/server/git/git.go +++ b/server/git/git.go @@ -205,8 +205,7 @@ func EnsureDefaultBranch(ctx context.Context, in io.Reader, out io.Writer, er io // Rename the default branch to the first branch available _, err = r.HEAD() if err == git.ErrReferenceNotExist { - err = RunGit(ctx, in, out, er, repoPath, []string{}, "branch", "-M", brs[0]) - if err != nil { + if _, err := r.SymbolicRef(git.HEAD, git.RefsHeads+brs[0]); err != nil { return err } }