Skip to content

Commit a5590f2

Browse files
committed
Inline visitedHashes check
Signed-off-by: Javi Fontan <[email protected]>
1 parent 1b03756 commit a5590f2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

internal/function/history_idx.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ func (f *HistoryIdx) repoHistoryIdx(repo *git.Repository, start, target plumbing
135135
frame := stack[len(stack)-1]
136136

137137
h := frame.hashes[frame.pos]
138-
_, ok := visitedHashes[h]
139-
if !ok {
138+
if _, ok := visitedHashes[h]; !ok {
140139
visitedHashes[h] = struct{}{}
141140
}
142141

@@ -162,8 +161,7 @@ func (f *HistoryIdx) repoHistoryIdx(repo *git.Repository, start, target plumbing
162161
if c.NumParents() > 0 {
163162
newParents := make([]plumbing.Hash, 0, c.NumParents())
164163
for _, h = range c.ParentHashes {
165-
_, ok = visitedHashes[h]
166-
if !ok {
164+
if _, ok := visitedHashes[h]; !ok {
167165
newParents = append(newParents, h)
168166
}
169167
}

0 commit comments

Comments
 (0)