Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 3918d0e

Browse files
committed
Simplify code
- Use append instead of ranged for loop - Simpler bool comparison Signed-off-by: Christian Muehlhaeuser <[email protected]>
1 parent c363771 commit 3918d0e

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Diff for: plumbing/object/commit_walker_bfs_filtered_test.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ func commitsFromIter(iter CommitIter) ([]*Commit, error) {
2929
func assertHashes(c *C, commits []*Commit, hashes []string) {
3030
if len(commits) != len(hashes) {
3131
var expected []string
32-
for _, c := range hashes {
33-
expected = append(expected, c)
34-
}
32+
expected = append(expected, hashes...)
3533
fmt.Println("expected:", strings.Join(expected, ", "))
3634
var got []string
3735
for _, c := range commits {
@@ -48,11 +46,7 @@ func assertHashes(c *C, commits []*Commit, hashes []string) {
4846

4947
func validIfCommit(ignored plumbing.Hash) CommitFilter {
5048
return func(c *Commit) bool {
51-
if c.Hash == ignored {
52-
return true
53-
}
54-
55-
return false
49+
return c.Hash == ignored
5650
}
5751
}
5852

0 commit comments

Comments
 (0)