Skip to content

Commit 55455c3

Browse files
committed
agh x 2
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 97ce1c7 commit 55455c3

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

modules/git/commit_info_nogogit.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,20 @@ revListLoop:
229229
break revListLoop
230230
}
231231
commitID = commitID[7:]
232+
delete(parentsRemaining, commitID)
233+
232234
if lastCommitID == commitID {
233-
// skip this
234-
if !scan.Scan() {
235-
break revListLoop
235+
// need to skip this commit but just add the parents
236+
nextParents = strings.Split(scan.Text(), " ")
237+
if len(nextParents[0]) > 40 {
238+
nextParents[0] = nextParents[0][40:]
239+
} else {
240+
nextParents = nil
241+
}
242+
for _, parent := range nextParents {
243+
parentsRemaining[parent] = true
236244
}
245+
237246
if !scan.Scan() {
238247
break revListLoop
239248
}
@@ -242,10 +251,8 @@ revListLoop:
242251
break revListLoop
243252
}
244253
commitID = commitID[7:]
254+
delete(parentsRemaining, commitID)
245255
}
246-
lastCommitID = commitID
247-
delete(parentsRemaining, commitID)
248-
249256
rootTreeID := scan.Text()
250257
nextParents = strings.Split(rootTreeID, " ")
251258
rootTreeID = nextParents[0][:40]
@@ -254,6 +261,7 @@ revListLoop:
254261
} else {
255262
nextParents = nil
256263
}
264+
lastCommitID = commitID
257265

258266
// push the tree to the cat-file --batch process
259267
_, err := batchStdinWriter.Write([]byte(rootTreeID + "\n"))
@@ -435,14 +443,18 @@ revListLoop:
435443

436444
scan, close = revlister(nioBuffer, commitID, commit.repo.Path, revlistPaths...)
437445
defer close()
446+
nextParents = nextParents[:0]
438447
if needToFind > 70 {
439448
nextRevList = 70
440449
} else {
441450
nextRevList = needToFind - 1
442451
}
443452
}
444453

445-
for _, parent := range nextParents {
454+
for i, parent := range nextParents {
455+
if parentsRemaining[parent] {
456+
nextParents[i] = ""
457+
}
446458
parentsRemaining[parent] = true
447459
}
448460
} else {

0 commit comments

Comments
 (0)