aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-08-02 13:13:46 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-08-02 13:13:46 +0200
commitab655650034b2acf36ce0237acaaf28b5d2572c0 (patch)
treec6d277c2650712726445c6cb15c47ffa63676263
parent171b3a73e7ab7015f9eb8e98965e36dfb8ea9599 (diff)
downloadgo-git-ab655650034b2acf36ce0237acaaf28b5d2572c0.tar.gz
*: use the new API for ReferenceName.Is* methods
-rw-r--r--remote.go4
-rw-r--r--remote_test.go2
-rw-r--r--repository.go8
-rw-r--r--repository_test.go8
-rw-r--r--worktree.go6
5 files changed, 13 insertions, 15 deletions
diff --git a/remote.go b/remote.go
index fe44009..f6cb728 100644
--- a/remote.go
+++ b/remote.go
@@ -464,7 +464,7 @@ func calculateRefs(spec []config.RefSpec,
refs := make(memory.ReferenceStorage, 0)
return refs, iter.ForEach(func(ref *plumbing.Reference) error {
if !config.MatchAny(spec, ref.Name()) {
- if !ref.IsTag() || tags != AllTags {
+ if !ref.Name().IsTag() || tags != AllTags {
return nil
}
}
@@ -663,7 +663,7 @@ func (r *Remote) updateLocalReferenceStorage(
func (r *Remote) buildFetchedTags(refs memory.ReferenceStorage) (updated bool, err error) {
for _, ref := range refs {
- if !ref.IsTag() {
+ if !ref.Name().IsTag() {
continue
}
diff --git a/remote_test.go b/remote_test.go
index ece052a..9e866a8 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -345,7 +345,7 @@ func (s *RemoteSuite) TestPushToEmptyRepository(c *C) {
expected := make(map[string]string)
iter.ForEach(func(ref *plumbing.Reference) error {
- if !ref.IsBranch() {
+ if !ref.Name().IsBranch() {
return nil
}
diff --git a/repository.go b/repository.go
index 00ffaf7..79c4d0a 100644
--- a/repository.go
+++ b/repository.go
@@ -538,7 +538,7 @@ func (r *Repository) fetchAndUpdateReferences(
func (r *Repository) updateReferences(spec []config.RefSpec,
resolvedHead *plumbing.Reference) (updated bool, err error) {
- if !resolvedHead.IsBranch() {
+ if !resolvedHead.Name().IsBranch() {
// Detached HEAD mode
head := plumbing.NewHashReference(plumbing.HEAD, resolvedHead.Hash())
return updateReferenceStorerIfNeeded(r.Storer, head)
@@ -698,7 +698,7 @@ func (r *Repository) Tags() (storer.ReferenceIter, error) {
return storer.NewReferenceFilteredIter(
func(r *plumbing.Reference) bool {
- return r.IsTag()
+ return r.Name().IsTag()
}, refIter), nil
}
@@ -711,7 +711,7 @@ func (r *Repository) Branches() (storer.ReferenceIter, error) {
return storer.NewReferenceFilteredIter(
func(r *plumbing.Reference) bool {
- return r.IsBranch()
+ return r.Name().IsBranch()
}, refIter), nil
}
@@ -724,7 +724,7 @@ func (r *Repository) Notes() (storer.ReferenceIter, error) {
return storer.NewReferenceFilteredIter(
func(r *plumbing.Reference) bool {
- return r.IsNote()
+ return r.Name().IsNote()
}, refIter), nil
}
diff --git a/repository_test.go b/repository_test.go
index 558149b..8855b18 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -623,7 +623,6 @@ func (s *RepositorySuite) TestCloneDetachedHEAD(c *C) {
func (s *RepositorySuite) TestPush(c *C) {
url := c.MkDir()
- fmt.Println(url)
server, err := PlainInit(url, true)
c.Assert(err, IsNil)
@@ -651,7 +650,6 @@ func (s *RepositorySuite) TestPush(c *C) {
func (s *RepositorySuite) TestPushContext(c *C) {
url := c.MkDir()
- fmt.Println(url)
_, err := PlainInit(url, true)
c.Assert(err, IsNil)
@@ -923,7 +921,7 @@ func (s *RepositorySuite) TestTags(c *C) {
tags.ForEach(func(tag *plumbing.Reference) error {
count++
c.Assert(tag.Hash().IsZero(), Equals, false)
- c.Assert(tag.IsTag(), Equals, true)
+ c.Assert(tag.Name().IsTag(), Equals, true)
return nil
})
@@ -944,7 +942,7 @@ func (s *RepositorySuite) TestBranches(c *C) {
branches.ForEach(func(branch *plumbing.Reference) error {
count++
c.Assert(branch.Hash().IsZero(), Equals, false)
- c.Assert(branch.IsBranch(), Equals, true)
+ c.Assert(branch.Name().IsBranch(), Equals, true)
return nil
})
@@ -968,7 +966,7 @@ func (s *RepositorySuite) TestNotes(c *C) {
notes.ForEach(func(note *plumbing.Reference) error {
count++
c.Assert(note.Hash().IsZero(), Equals, false)
- c.Assert(note.IsNote(), Equals, true)
+ c.Assert(note.Name().IsNote(), Equals, true)
return nil
})
diff --git a/worktree.go b/worktree.go
index 4e4d544..d2ac6f5 100644
--- a/worktree.go
+++ b/worktree.go
@@ -209,7 +209,7 @@ func (w *Worktree) getCommitFromCheckoutOptions(opts *CheckoutOptions) (plumbing
return plumbing.ZeroHash, err
}
- if !b.IsTag() {
+ if !b.Name().IsTag() {
return b.Hash(), nil
}
@@ -244,7 +244,7 @@ func (w *Worktree) setHEADToBranch(branch plumbing.ReferenceName, commit plumbin
}
var head *plumbing.Reference
- if target.IsBranch() {
+ if target.Name().IsBranch() {
head = plumbing.NewSymbolicReference(plumbing.HEAD, target.Name())
} else {
head = plumbing.NewHashReference(plumbing.HEAD, commit)
@@ -323,7 +323,7 @@ func (w *Worktree) setHEADCommit(commit plumbing.Hash) error {
return err
}
- if !branch.IsBranch() {
+ if !branch.Name().IsBranch() {
return fmt.Errorf("invalid HEAD target should be a branch, found %s", branch.Type())
}