fix: initial default branch name

Ayman Bagabas created

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

Change summary

server/git/git.go | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Detailed changes

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
 		}
 	}