warn if two similar git config values are seen
This commit is contained in:
parent
265feee819
commit
dcb2d4e1e9
@ -386,6 +386,8 @@ func (c *Configuration) readGitConfigFromFiles(filenames []string, filenameIndex
|
||||
|
||||
func (c *Configuration) readGitConfig(output string, uniqRemotes map[string]bool, onlySafe bool) {
|
||||
lines := strings.Split(output, "\n")
|
||||
uniqKeys := make(map[string]string)
|
||||
|
||||
for _, line := range lines {
|
||||
pieces := strings.SplitN(line, "=", 2)
|
||||
if len(pieces) < 2 {
|
||||
@ -396,6 +398,12 @@ func (c *Configuration) readGitConfig(output string, uniqRemotes map[string]bool
|
||||
key := strings.ToLower(pieces[0])
|
||||
value := pieces[1]
|
||||
|
||||
if origKey, ok := uniqKeys[key]; ok {
|
||||
fmt.Fprintf(os.Stderr, "WARNING: The %q value clashes with the existing %q value.\n", pieces[0], origKey)
|
||||
} else {
|
||||
uniqKeys[key] = pieces[0]
|
||||
}
|
||||
|
||||
keyParts := strings.Split(key, ".")
|
||||
if len(keyParts) == 4 && keyParts[0] == "lfs" && keyParts[1] == "extension" {
|
||||
name := keyParts[2]
|
||||
|
Loading…
Reference in New Issue
Block a user