Skip to content

Walk through re-imported history behind a root commit - #39

Merged
rumblefrog merged 1 commit into
masterfrom
claude/eager-fermat-2rzp0a
Sep 25, 2026
Merged

rumblefrog merged 1 commit into
masterfrom
claude/eager-fermat-2rzp0a

Conversation

@rumblefrog

Copy link
Copy Markdown
Member

Follow-up to #31, fixing a regression it introduced for SourceMod.

Problem

SourceMod has three root commits. The mainline (first parent from HEAD) starts at 251cced (2008-03-30, "Spring Cleaning"). Its plugins/include is identical to 3a14544 (2008-03-28) in the older SVN history. That older history only reconnects as the second parent of the 2008-09 "Eliminated head" merges.

After #31 the walk followed first parents only, so it stopped at the snapshot:

  • 1,581 symbols were "created" on 2008-03-30. For example, PrintToChat was really added 2007-06-01 (6c17b9f), GetClientName 2007-02-27, and HookEvent 2007-03-04.
  • 1,017 symbols had "last updated" set to the snapshot instead of their real earlier change.

Change

  • When the first-parent walk reaches a root commit, it looks for the latest commit elsewhere in HEAD's history, no newer than the root, whose files matching the patterns are identical to the root's. It then keeps walking first parents from there.
  • Each commit is diffed against the previous commit walked. A re-imported root is unchanged from its predecessor, so it produces no changes.
  • A root with no such predecessor is still diffed against an empty tree.
  • The rev-list count is recomputed at the root. SourceMod counts restart there (e.g. PrintToChat is created at count 872, before 251cced at count 1), because that is what git rev-list --count reports for those commits.

Verification

  • Two new walker tests: re-imported history, and an unrelated root that still starts from an empty tree. All 4 history tests pass.
  • Ran the 11 upstream repos from the parser corpus (update-corpus.sh include patterns) and compared every symbol, nested ones included, against a reference that uses the git CLI. All 5,252 symbols match on created, last updated and count, with no missing or extra symbols. SourceMod now walks 1,133 changing commits instead of 713.
  • PrintToChat, GetClientName and HookEvent are back to their 2007 commits. GetClientAuthId stays at the #147 merge (count 4830).
  • No measurable slowdown: SourceMod goes from 5.2s to 6.1s because it walks about 420 more commits. The other repos are unchanged.

Bundles generated after #31 should be regenerated from scratch (without -b).

🤖 Generated with Claude Code

https://claude.ai/code/session_01UmDZ8MBYNvgeQ52tpsJe3t


Generated by Claude Code

A root commit can re-import the files of an older history that is only
reachable through a later merge's second parent. SourceMod's mainline
starts at 251cced (2008-03-30), a snapshot identical to 3a14544 in the
SVN history, which is joined back in by the 2008-09 "Eliminated head"
merges. Following first parents stopped at the snapshot, dating 1,581
symbols (e.g. PrintToChat, added 2007-06-01) to 2008-03-30.

When the first-parent walk reaches a root, continue from the latest
older commit elsewhere in HEAD's history whose matching files are
identical, diffing each commit against the previous one walked. A root
with no such predecessor is still compared against an empty tree. The
rev-list count restarts from the root's own count after the predecessor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UmDZ8MBYNvgeQ52tpsJe3t
@rumblefrog
rumblefrog merged commit 9c54a72 into master Sep 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants