Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit 1619c9e

Browse files
committed
BUG/MINOR: sections: allow setting from to empty string
1 parent da1a2ec commit 1619c9e

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

fetch.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,17 @@ func (p *configParser) SectionsDefaultsFromSet(sectionType Section, sectionName,
197197
if !ok {
198198
return errors.ErrSectionMissing
199199
}
200-
stDef, ok := p.Parsers[Defaults]
201-
if !ok {
202-
return errors.ErrSectionTypeMissing
203-
}
204-
_, ok = stDef[defaultsSection]
205-
if !ok {
206-
return errors.ErrSectionMissing
200+
// if not set to empty, do extra validation
201+
if defaultsSection != "" {
202+
stDef, ok := p.Parsers[Defaults]
203+
if !ok {
204+
return errors.ErrSectionTypeMissing
205+
}
206+
_, ok = stDef[defaultsSection]
207+
if !ok {
208+
return errors.ErrSectionMissing
209+
}
207210
}
208-
209211
section.DefaultSectionName = defaultsSection
210212
return nil
211213
}

0 commit comments

Comments
 (0)