Object walk painting#1973
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the revlist.Objects() traversal to restore previously achieved performance improvements while maintaining correctness in the presence of out-of-order commit times, and aligns a couple of edge-case tests with git rev-list --objects behavior.
Changes:
- Reworks the object walk commit traversal to use a “painted” (want/have flags) priority-queue style walk with early stopping.
- Updates/renames regression tests to compare object sets directly against
git rev-list --objectsfor specific edge cases. - Refactors some test helpers for building commits/trees across different storers (in-memory vs on-disk fixtures).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| plumbing/revlist/object_walk.go | Replaces the interleaved want/have walk with a painted, time-prioritized traversal and adds helpers for sorted insertion / stale detection. |
| plumbing/revlist/revlist_test.go | Updates regression tests (including comparisons to git rev-list --objects) and refactors commit/tree construction helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5601c61 to
83d1695
Compare
| {Name: "have", Mode: filemode.Regular, Hash: s.makeBlob("have")}, | ||
| // gitRevListObjects runs git rev-list --objects want ^have against the | ||
| // given git directory and returns the set of object hashes. | ||
| func gitRevListObjects(t *testing.T, gitDir string, want, have plumbing.Hash) map[plumbing.Hash]bool { |
There was a problem hiding this comment.
I think this is brilliant, for this package we are probably better off:
- Making a single table driven test with all current scenarios
- Match execution failure with expected errors from Objects()
- Match the actual objects
This way we have a few different repos with a given set of scenarios, and we can match implementation conformance more easily.
There was a problem hiding this comment.
Should we tackle that in this PR or a separate one?
d4d01e6 to
10d5287
Compare
Also updates and expands tests to capture more git rev-list behaviour Assisted-by: Claude Opus 4.6 (1M context) <[email protected]>
10d5287 to
fe32f7a
Compare
After some of the changes to #1947, the performance gains weren't realised.
This PR restores the performance gains while still maintaining correctness (mainly the commit time ordering issue).
TestRevListObjects_SkewedCommitTimesDoNotResendCommonBaseMaintained. The painting commits approach deals with out of order commit times.Two other tests were changed to match
git rev-listbehaviour:TestRevListObjects_ReintroducedBlobInHaveAncestorIsExcludedbecameTestRevListObjects_ReintroducedBlobInHaveAncestorand verified behaviour against a call togit rev-list.TestRevListObjects_MissingHaveAncestorReturnsErrorbecameTestRevListObjects_MissingHaveAncestorIsTolerated, verified with a call togit rev-list.Performance summary (
Objectsis this PR):