diff options
Diffstat (limited to 'config/refspec.go')
-rw-r--r-- | config/refspec.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/config/refspec.go b/config/refspec.go index b2b3203..14bb400 100644 --- a/config/refspec.go +++ b/config/refspec.go @@ -18,7 +18,7 @@ var ( ErrRefSpecMalformedWildcard = errors.New("malformed refspec, mismatched number of wildcards") ) -// RefSpec is a mapping from local branches to remote references +// RefSpec is a mapping from local branches to remote references. // The format of the refspec is an optional +, followed by <src>:<dst>, where // <src> is the pattern for references on the remote side and <dst> is where // those references will be written locally. The + tells Git to update the @@ -99,11 +99,11 @@ func (s RefSpec) matchGlob(n plumbing.ReferenceName) bool { var prefix, suffix string prefix = src[0:wildcard] - if len(src) < wildcard { - suffix = src[wildcard+1 : len(suffix)] + if len(src) > wildcard+1 { + suffix = src[wildcard+1:] } - return len(name) > len(prefix)+len(suffix) && + return len(name) >= len(prefix)+len(suffix) && strings.HasPrefix(name, prefix) && strings.HasSuffix(name, suffix) } |