diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-11-08 23:46:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-08 23:46:38 +0100 |
commit | ac095bb12c4d29722b60ba9f20590fa7cfa6bc7d (patch) | |
tree | 223f36f336ba3414b1e45cac8af6c4744a5d7ef6 /config/refspec.go | |
parent | e523701393598f4fa241dd407af9ff8925507a1a (diff) | |
download | go-git-ac095bb12c4d29722b60ba9f20590fa7cfa6bc7d.tar.gz |
new plumbing package (#118)
* plumbing: now core was renamed to core, and formats and clients moved inside
Diffstat (limited to 'config/refspec.go')
-rw-r--r-- | config/refspec.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/config/refspec.go b/config/refspec.go index 0f41c5a..fd0aa3d 100644 --- a/config/refspec.go +++ b/config/refspec.go @@ -3,7 +3,7 @@ package config import ( "strings" - "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/plumbing" ) const ( @@ -57,8 +57,8 @@ func (s RefSpec) Src() string { return spec[start:end] } -// Match match the given core.ReferenceName against the source -func (s RefSpec) Match(n core.ReferenceName) bool { +// Match match the given plumbing.ReferenceName against the source +func (s RefSpec) Match(n plumbing.ReferenceName) bool { if !s.IsWildcard() { return s.matchExact(n) } @@ -71,11 +71,11 @@ func (s RefSpec) IsWildcard() bool { return strings.Index(string(s), refSpecWildcard) != -1 } -func (s RefSpec) matchExact(n core.ReferenceName) bool { +func (s RefSpec) matchExact(n plumbing.ReferenceName) bool { return s.Src() == n.String() } -func (s RefSpec) matchGlob(n core.ReferenceName) bool { +func (s RefSpec) matchGlob(n plumbing.ReferenceName) bool { src := s.Src() name := n.String() wildcard := strings.Index(src, refSpecWildcard) @@ -92,14 +92,14 @@ func (s RefSpec) matchGlob(n core.ReferenceName) bool { } // Dst returns the destination for the given remote reference -func (s RefSpec) Dst(n core.ReferenceName) core.ReferenceName { +func (s RefSpec) Dst(n plumbing.ReferenceName) plumbing.ReferenceName { spec := string(s) start := strings.Index(spec, refSpecSeparator) + 1 dst := spec[start:] src := s.Src() if !s.IsWildcard() { - return core.ReferenceName(dst) + return plumbing.ReferenceName(dst) } name := n.String() @@ -107,7 +107,7 @@ func (s RefSpec) Dst(n core.ReferenceName) core.ReferenceName { wd := strings.Index(dst, refSpecWildcard) match := name[ws : len(name)-(len(src)-(ws+1))] - return core.ReferenceName(dst[0:wd] + match + dst[wd+1:]) + return plumbing.ReferenceName(dst[0:wd] + match + dst[wd+1:]) } func (s RefSpec) String() string { @@ -115,7 +115,7 @@ func (s RefSpec) String() string { } // MatchAny returns true if any of the RefSpec match with the given ReferenceName -func MatchAny(l []RefSpec, n core.ReferenceName) bool { +func MatchAny(l []RefSpec, n plumbing.ReferenceName) bool { for _, r := range l { if r.Match(n) { return true |