diff options
author | ferhat elmas <elmas.ferhat@gmail.com> | 2017-11-29 02:24:31 +0100 |
---|---|---|
committer | ferhat elmas <elmas.ferhat@gmail.com> | 2017-11-29 13:01:32 +0100 |
commit | 18e6f9daa3899318d36b525b068837f49bc2c1cf (patch) | |
tree | a797b79d0a750972ba9809eb52691cb09f9b6383 /config/refspec.go | |
parent | c07c778ed043429427533e2fd7549a3d54b903f1 (diff) | |
download | go-git-18e6f9daa3899318d36b525b068837f49bc2c1cf.tar.gz |
all: simplification
- no length for map initialization
- don't check for boolean/error return
- don't format string
- use string method of bytes buffer instead of converting bytes to
string
- use `strings.Contains` instead of `strings.Index`
- use `bytes.Equal` instead of `bytes.Compare`
Diffstat (limited to 'config/refspec.go')
-rw-r--r-- | config/refspec.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/config/refspec.go b/config/refspec.go index 7e4106a..af7e732 100644 --- a/config/refspec.go +++ b/config/refspec.go @@ -51,20 +51,12 @@ func (s RefSpec) Validate() error { // IsForceUpdate returns if update is allowed in non fast-forward merges. func (s RefSpec) IsForceUpdate() bool { - if s[0] == refSpecForce[0] { - return true - } - - return false + return s[0] == refSpecForce[0] } // IsDelete returns true if the refspec indicates a delete (empty src). func (s RefSpec) IsDelete() bool { - if s[0] == refSpecSeparator[0] { - return true - } - - return false + return s[0] == refSpecSeparator[0] } // Src return the src side. @@ -87,7 +79,7 @@ func (s RefSpec) Match(n plumbing.ReferenceName) bool { // IsWildcard returns true if the RefSpec contains a wildcard. func (s RefSpec) IsWildcard() bool { - return strings.Index(string(s), refSpecWildcard) != -1 + return strings.Contains(string(s), refSpecWildcard) } func (s RefSpec) matchExact(n plumbing.ReferenceName) bool { |