aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/object')
-rw-r--r--plumbing/object/commit_walker_bfs_filtered_test.go10
-rw-r--r--plumbing/object/merge_base.go2
-rw-r--r--plumbing/object/patch.go2
-rw-r--r--plumbing/object/patch_test.go1
-rw-r--r--plumbing/object/tree.go4
5 files changed, 7 insertions, 12 deletions
diff --git a/plumbing/object/commit_walker_bfs_filtered_test.go b/plumbing/object/commit_walker_bfs_filtered_test.go
index d31bdf0..6984b60 100644
--- a/plumbing/object/commit_walker_bfs_filtered_test.go
+++ b/plumbing/object/commit_walker_bfs_filtered_test.go
@@ -29,9 +29,7 @@ func commitsFromIter(iter CommitIter) ([]*Commit, error) {
func assertHashes(c *C, commits []*Commit, hashes []string) {
if len(commits) != len(hashes) {
var expected []string
- for _, c := range hashes {
- expected = append(expected, c)
- }
+ expected = append(expected, hashes...)
fmt.Println("expected:", strings.Join(expected, ", "))
var got []string
for _, c := range commits {
@@ -48,11 +46,7 @@ func assertHashes(c *C, commits []*Commit, hashes []string) {
func validIfCommit(ignored plumbing.Hash) CommitFilter {
return func(c *Commit) bool {
- if c.Hash == ignored {
- return true
- }
-
- return false
+ return c.Hash == ignored
}
}
diff --git a/plumbing/object/merge_base.go b/plumbing/object/merge_base.go
index 689e421..6f2568d 100644
--- a/plumbing/object/merge_base.go
+++ b/plumbing/object/merge_base.go
@@ -32,7 +32,7 @@ func (c *Commit) MergeBase(other *Commit) ([]*Commit, error) {
var res []*Commit
inNewerHistory := isInIndexCommitFilter(newerHistory)
resIter := NewFilterCommitIter(older, &inNewerHistory, &inNewerHistory)
- err = resIter.ForEach(func(commit *Commit) error {
+ _ = resIter.ForEach(func(commit *Commit) error {
res = append(res, commit)
return nil
})
diff --git a/plumbing/object/patch.go b/plumbing/object/patch.go
index 1efd0b1..32454ac 100644
--- a/plumbing/object/patch.go
+++ b/plumbing/object/patch.go
@@ -278,7 +278,7 @@ func printStat(fileStats []FileStat) string {
var scaleFactor float64
if longestTotalChange > heightOfHistogram {
// Scale down to heightOfHistogram.
- scaleFactor = float64(longestTotalChange / heightOfHistogram)
+ scaleFactor = longestTotalChange / heightOfHistogram
} else {
scaleFactor = 1.0
}
diff --git a/plumbing/object/patch_test.go b/plumbing/object/patch_test.go
index 47057fb..37944c3 100644
--- a/plumbing/object/patch_test.go
+++ b/plumbing/object/patch_test.go
@@ -19,6 +19,7 @@ func (s *PatchSuite) TestStatsWithSubmodules(c *C) {
fixtures.ByURL("https://github.com/git-fixtures/submodule.git").One().DotGit(), cache.NewObjectLRUDefault())
commit, err := GetCommit(storer, plumbing.NewHash("b685400c1f9316f350965a5993d350bc746b0bf4"))
+ c.Assert(err, IsNil)
tree, err := commit.Tree()
c.Assert(err, IsNil)
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go
index d30cf6e..d0b4fff 100644
--- a/plumbing/object/tree.go
+++ b/plumbing/object/tree.go
@@ -288,7 +288,7 @@ func (t *Tree) Encode(o plumbing.EncodedObject) (err error) {
return err
}
- if _, err = w.Write([]byte(entry.Hash[:])); err != nil {
+ if _, err = w.Write(entry.Hash[:]); err != nil {
return err
}
}
@@ -517,4 +517,4 @@ func simpleJoin(parent, child string) string {
return parent + "/" + child
}
return child
-} \ No newline at end of file
+}