IJPL-248963 fix stale parent propagation in VcsLogJoiner - #3559
Closed
Sergej Salnikov (SergejSalnikov) wants to merge 5 commits into
Closed
IJPL-248963 fix stale parent propagation in VcsLogJoiner#3559Sergej Salnikov (SergejSalnikov) wants to merge 5 commits into
Sergej Salnikov (SergejSalnikov) wants to merge 5 commits into
Conversation
Sergej Salnikov (SergejSalnikov)
marked this pull request as draft
July 7, 2026 14:26
Redesign addCommits to use a single-pass reconstruction with a firstBlockMap that serves as lookup, replacement source, and new-commit tracker simultaneously. The root cause was that RedGreenSorter propagated stale parent lists from savedLog for commits that also appeared in firstBlock with updated parents. This caused removed commits to be incorrectly marked as green and survive refresh, growing the log on every refresh. Fix: pass a recentCommitParents map to RedGreenSorter so it propagates updated parents from firstBlock instead of stale ones from savedLog. Additionally, replace the fragile getSavedGreenIndex (parent-chain tracing with root-commit special cases) with a direct overlap scan that finds how deep firstBlock penetrates into savedLog. This handles disconnected islands, root commits, and same-data refreshes correctly without special cases. Removed: getSavedGreenIndex, getFirstUnTrackedIndex, getAllNewCommits. Net result: -52 lines, simpler logic. https://youtrack.jetbrains.com/issue/IJPL-248963
Sergej Salnikov (SergejSalnikov)
force-pushed
the
master
branch
from
July 7, 2026 15:15
c542ac4 to
cf35b45
Compare
Sergej Salnikov (SergejSalnikov)
marked this pull request as ready for review
July 7, 2026 15:15
Redesign addCommits to replace the fragile green-index parent-chain tracing with a direct overlap scan. The old approach computed a "green index" by tracing parent chains from firstBlock into savedLog, which had edge cases with root commits and could miscalculate the scan depth — leading to duplicate commits on every refresh. The new approach uses a firstBlockMap that serves as lookup, replacement source, and new-commit tracker simultaneously. A single pass over the unsafe zone handles filtering, replacement, and new-commit detection. Additionally fix two stale-data bugs in RedGreenSorter: - Propagate updated parents from firstBlock instead of stale ones from savedLog, preventing removed commits from being incorrectly kept alive. - Mark dropped parents (old parents no longer in the updated parent list) as red candidates, so commits that become unreachable due to parent changes are properly removed even when no ref changes occur.
Ivan Semenov (iasemenov)
requested a review
from Natalia Ponomareva (whitec10ud)
August 10, 2026 13:04
Collaborator
|
Thanks a lot for the contribution! We really appreciate you taking the time to investigate this and submit a fix. The issue ([IJPL-248963](https://youtrack.jetbrains.com/issue/IJPL-248963/VcsLogJoiner-Stale-Parent-Propagation-Bug)) has been fixed on our side and the fix will be available in the next IDE release. For now, we decided to go with a smaller, targeted fix for this specific issue rather than incorporating the broader refactorings from this PR. Nevertheless, thank you again for the contribution and for bringing this to our attention! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root commits (no parents) in the first block were incorrectly kept in the unresolved-hashes set because the removal was guarded by
!commit.getParents().isEmpty(). This causedgetFirstUnTrackedIndexto scan the saved log looking for these root commit IDs, throwingVcsLogRefreshNotEnoughDataExceptionwhen they were not found.Additionally,
getAllNewCommitswas deduplicated against only the green-index range of the saved log rather than the full unsafe block size. When the red index exceeded the green index, commits in the gap were not checked, potentially producing duplicate entries in the merged result.Fix both issues by:
firstBlockIdsset),savedLog[0..unsafeBlockSize)instead ofsavedLog[0..greenIndex), ensuring correct deduplication regardless of which index is larger.https://youtrack.jetbrains.com/issue/IJPL-248963