aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
diff options
context:
space:
mode:
authorChristian Muehlhaeuser <muesli@gmail.com>2019-07-21 05:52:00 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2019-07-29 17:30:29 +0200
commitd3c45dc2f0898d5a5bd48860eb74005faa6c8ec5 (patch)
tree399d022b72201fb35e25cc606b62a8cae0ca34ec /plumbing/object
parentb294aa1351a9c1e9388d7901033596514cf5eaa9 (diff)
downloadgo-git-d3c45dc2f0898d5a5bd48860eb74005faa6c8ec5.tar.gz
plumbing/object: simplify code
- Use append instead of ranged for loop - Simpler bool comparison Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 3918d0e1b73f5e59a8c93e2b5ae99295cef26cf9)
Diffstat (limited to 'plumbing/object')
-rw-r--r--plumbing/object/commit_walker_bfs_filtered_test.go10
1 files changed, 2 insertions, 8 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
}
}