aboutsummaryrefslogtreecommitdiffstats
path: root/repository
diff options
context:
space:
mode:
authorSteve Moyer <smoyer1@selesy.com>2022-11-27 20:56:45 -0500
committerSteve Moyer <smoyer1@selesy.com>2022-11-27 20:56:45 -0500
commit49929c034f52272986ea6ac7457e64dbaa9454cb (patch)
tree8b025e72fedaa084cf445d17dbdab0e060cf9e0c /repository
parent64c18b15a4a0c8b7e59587aa09de92d52c698ede (diff)
downloadgit-bug-49929c034f52272986ea6ac7457e64dbaa9454cb.tar.gz
feat: wrap ErrMultipleConfigEntry to report duplicate key
References #935.
Diffstat (limited to 'repository')
-rw-r--r--repository/config.go6
-rw-r--r--repository/gogit_config.go4
2 files changed, 5 insertions, 5 deletions
diff --git a/repository/config.go b/repository/config.go
index 4d6a8c6c..781a0c1d 100644
--- a/repository/config.go
+++ b/repository/config.go
@@ -96,7 +96,7 @@ func (m *mergedConfig) ReadBool(key string) (bool, error) {
if err == nil {
return v, nil
}
- if !errors.Is(err, ErrNoConfigEntry) && err != ErrMultipleConfigEntry {
+ if !errors.Is(err, ErrNoConfigEntry) && !errors.Is(err, ErrMultipleConfigEntry) {
return false, err
}
return m.global.ReadBool(key)
@@ -107,7 +107,7 @@ func (m *mergedConfig) ReadString(key string) (string, error) {
if err == nil {
return val, nil
}
- if !errors.Is(err, ErrNoConfigEntry) && err != ErrMultipleConfigEntry {
+ if !errors.Is(err, ErrNoConfigEntry) && !errors.Is(err, ErrMultipleConfigEntry) {
return "", err
}
return m.global.ReadString(key)
@@ -118,7 +118,7 @@ func (m *mergedConfig) ReadTimestamp(key string) (time.Time, error) {
if err == nil {
return val, nil
}
- if !errors.Is(err, ErrNoConfigEntry) && err != ErrMultipleConfigEntry {
+ if !errors.Is(err, ErrNoConfigEntry) && !errors.Is(err, ErrMultipleConfigEntry) {
return time.Time{}, err
}
return m.global.ReadTimestamp(key)
diff --git a/repository/gogit_config.go b/repository/gogit_config.go
index 87141e9d..2bdbadc0 100644
--- a/repository/gogit_config.go
+++ b/repository/gogit_config.go
@@ -130,7 +130,7 @@ func (cr *goGitConfigReader) ReadString(key string) (string, error) {
return "", fmt.Errorf("%w: missing key %s", ErrNoConfigEntry, key)
}
if len(section.OptionAll(optionName)) > 1 {
- return "", ErrMultipleConfigEntry
+ return "", fmt.Errorf("%w: duplicated key %s", ErrMultipleConfigEntry, key)
}
return section.Option(optionName), nil
default:
@@ -144,7 +144,7 @@ func (cr *goGitConfigReader) ReadString(key string) (string, error) {
return "", fmt.Errorf("%w: missing key %s", ErrNoConfigEntry, key)
}
if len(subsection.OptionAll(optionName)) > 1 {
- return "", ErrMultipleConfigEntry
+ return "", fmt.Errorf("%w: duplicated key %s", ErrMultipleConfigEntry, key)
}
return subsection.Option(optionName), nil
}