(key string, defaultValue bool)
| 133 | } |
| 134 | |
| 135 | func (repo *Repository) ConfigBoolDefault(key string, defaultValue bool) (bool, error) { |
| 136 | cmd := repo.GitCommand( |
| 137 | "config", |
| 138 | "--type", "bool", |
| 139 | "--default", strconv.FormatBool(defaultValue), |
| 140 | key, |
| 141 | ) |
| 142 | |
| 143 | out, err := cmd.Output() |
| 144 | if err != nil { |
| 145 | return defaultValue, fmt.Errorf("running 'git config': %w", err) |
| 146 | } |
| 147 | |
| 148 | s := string(bytes.TrimSpace(out)) |
| 149 | value, err := strconv.ParseBool(s) |
| 150 | if err != nil { |
| 151 | return defaultValue, fmt.Errorf("unexpected bool value from 'git config': %q", s) |
| 152 | } |
| 153 | |
| 154 | return value, nil |
| 155 | } |
| 156 | |
| 157 | func (repo *Repository) ConfigIntDefault(key string, defaultValue int) (int, error) { |
| 158 | cmd := repo.GitCommand( |
no test coverage detected