MCPcopy Index your code
hub / github.com/commitdev/zero / getInitDefaultBranch

Function getInitDefaultBranch

internal/vcs/create-git-repos.go:159–170  ·  view source on GitHub ↗

getInitDefaultBranch return init.defaultBranch value in git config. If init.defaultBranch isn't set, getInitDefaultBranch return 'main'.

()

Source from the content-addressed store, hash-verified

157// getInitDefaultBranch return init.defaultBranch value in git config.
158// If init.defaultBranch isn't set, getInitDefaultBranch return 'main'.
159func getInitDefaultBranch() string {
160 cmd := exec.Command("git", "config", "--get", "init.defaultBranch")
161
162 output, err := cmd.CombinedOutput()
163
164 if err != nil {
165 return "main"
166 }
167
168 branchName := strings.TrimSuffix(string(output), "\n")
169 return branchName
170}
171
172// doInitialCommit runs the git commands that initialize and do the first commit to a repository.
173func doInitialCommit(ownerName string, repositoryName string) error {

Callers 1

doInitialCommitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected