RemoveAll remove all key/value pair matching the key prefix
(keyPrefix string)
| 80 | |
| 81 | // RemoveAll remove all key/value pair matching the key prefix |
| 82 | func (mc *MemConfig) RemoveAll(keyPrefix string) error { |
| 83 | keyPrefix = normalizeKey(keyPrefix) |
| 84 | for key := range mc.config { |
| 85 | if strings.HasPrefix(key, keyPrefix) { |
| 86 | delete(mc.config, key) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | return nil |
| 91 | } |
| 92 | |
| 93 | func normalizeKey(key string) string { |
| 94 | // this feels so wrong, but that's apparently how git behave. |
nothing calls this directly
no test coverage detected