Skip to content

Commit

Permalink
fix: initial default branch name
Browse files Browse the repository at this point in the history
Use git plumbing to set the initial default branch name.

Fixes: #147
Fixes: #260
  • Loading branch information
aymanbagabas committed Jul 18, 2023
1 parent 9b8e183 commit fee41f4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions server/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit fee41f4

Please sign in to comment.