MCPcopy Index your code
hub / github.com/github/git-sizer / ConfigStringDefault

Method ConfigStringDefault

git/gitconfig.go:116–133  ·  view source on GitHub ↗
(key string, defaultValue string)

Source from the content-addressed store, hash-verified

114}
115
116func (repo *Repository) ConfigStringDefault(key string, defaultValue string) (string, error) {
117 cmd := repo.GitCommand(
118 "config",
119 "--default", defaultValue,
120 key,
121 )
122
123 out, err := cmd.Output()
124 if err != nil {
125 return defaultValue, fmt.Errorf("running 'git config': %w", err)
126 }
127
128 if len(out) > 0 && out[len(out)-1] == '\n' {
129 out = out[:len(out)-1]
130 }
131
132 return string(out), nil
133}
134
135func (repo *Repository) ConfigBoolDefault(key string, defaultValue bool) (bool, error) {
136 cmd := repo.GitCommand(

Callers 1

mainImplementationFunction · 0.95

Calls 2

GitCommandMethod · 0.95
OutputMethod · 0.80

Tested by

no test coverage detected