Skip to content

Commit ef33fff

Browse files
authored
Merge pull request go-git#128 from cristaloleg/minor-perf-fixes
Use EqualFold for comparison
2 parents e626226 + 5c4c24b commit ef33fff

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

plumbing/format/config/option.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Options []*Option
1919
// IsKey returns true if the given key matches
2020
// this option's key in a case-insensitive comparison.
2121
func (o *Option) IsKey(key string) bool {
22-
return strings.ToLower(o.Key) == strings.ToLower(key)
22+
return strings.EqualFold(o.Key, key)
2323
}
2424

2525
func (opts Options) GoString() string {

plumbing/format/config/section.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (s Subsections) GoString() string {
6161

6262
// IsName checks if the name provided is equals to the Section name, case insensitive.
6363
func (s *Section) IsName(name string) bool {
64-
return strings.ToLower(s.Name) == strings.ToLower(name)
64+
return strings.EqualFold(s.Name, name)
6565
}
6666

6767
// Option return the value for the specified key. Empty string is returned if

0 commit comments

Comments
 (0)