Skip to content

fix: keep the pre-rename file history on Git 2.56 - #127

Merged
numlia merged 5 commits into
mainfrom
fix/git-2-56-follow-lineage
Oct 27, 2026
Merged

numlia merged 5 commits into
mainfrom
fix/git-2-56-follow-lineage

Conversation

@numlia

@numlia numlia commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Background

Git 2.56 changed git log --follow to keep one path per commit. A commit reached from two history lines now takes the path of the line Git walks last. When a renamed file is merged and the merge does not detect the rename, Highlight File History loses every entry from before the rename. CI fails on runners with Git 2.56.0 (TC-350, TC-352) and passes on 2.55.0 with the same commit.

Changes

  • After the lineage query, run the lineage query again on the old path for each rename it follows, and splice those results in after the rename commit. Every lineage query from the same anchor walks the same commit list (--follow disables pruning), so the results match Git 2.55 and earlier.
  • If a continuation query fails, returns malformed output, or does not contain the rename commit, return null, the same as for the other queries.
  • Add tests for continuation spawn order and failures, for the two pure helpers, and for a two-step rename chain against a real repository. The spawn order expectations of TC-333, TC-341 and TC-343 now include the extra query.

Points to review

  • Each followed rename adds one Git query that walks the whole history from the anchor, so a file renamed many times costs one walk per rename.
    • See: src/dataSource.ts::queryFileHistoryLineage
  • The lineage rules are unchanged: as on Git 2.55, edits to the old path on the other side of a rename-undetected merge are still included (TC-352).
    • See: tests/src/dataSource.git.test.ts TC-352

Verification

  • Ran the full test suite with Git 2.43.0 and a locally built Git 2.56.0. Both pass, and on 2.56.0 TC-350, TC-352 and TC-803 fail without the fix.

Summary by CodeRabbit

  • Bug Fixes
    • File history now follows renamed paths, recovering earlier history across single or multiple renames. If a continuation query fails or returns invalid history, the lookup returns no result.
  • Tests
    • Added coverage for rename-chain history, continuation failures, and real-repository rename scenarios.
  • Documentation
    • Updated test guides and indexes to reflect the expanded file-history coverage.

- Git 2.56 makes `git log --follow` keep one path per commit, and a commit reached from two history lines takes the path of the line walked last, so the file history lost every entry before a rename when the merge did not detect it
- After the lineage query, run the lineage query again on the old path of each followed rename and splice its groups after the rename commit; every query walks the same unpruned topo-order list, so the results match Git 2.55 and earlier
- Return null when a continuation query fails, is malformed, or lacks the rename commit, as for the other queries
- Add findLineageRename() and spliceLineageContinuation() with unit tests, continuation spawn tests (S52), and a two-step rename chain against a real repository (S53)
- Update the S49 spawn order expectations (TC-333, TC-341, TC-343) for the extra continuation query
- Verified with Git 2.43.0 and 2.56.0: all tests pass, and TC-350, TC-352 and TC-803 fail on Git 2.56.0 without the fix
- Add S52 (continuation spawn order and failures) and S53 (rename chain on a real repository) to the file history perspectives of src/dataSource.ts
- Add S9 (findLineageRename / spliceLineageContinuation) to the src/fileHistory.ts perspectives
- Rewrite S49 in English with the updated spawn order of TC-333, TC-341 and TC-343
- Update the dataSource shard manifest and regenerate the root INDEX, which also corrects the stale web/utils.ts counts on main
@numlia numlia self-assigned this Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between d5d65aa and 2243c67.

Files selected for processing: 9
  • docs/testing/perspectives/INDEX.md
  • docs/testing/perspectives/src/dataSource-test/07-file-history-01.md
  • docs/testing/perspectives/src/dataSource-test/INDEX.md
  • docs/testing/perspectives/src/fileHistory-test.md
  • src/dataSource.ts
  • src/fileHistory.ts
  • tests/src/dataSource.git.test.ts
  • tests/src/dataSource.test.ts
  • tests/src/fileHistory.test.ts

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 7b6b211 and d5d65aa.

Files selected for processing: 9
  • docs/testing/perspectives/INDEX.md
  • docs/testing/perspectives/src/dataSource-test/07-file-history-01.md
  • docs/testing/perspectives/src/dataSource-test/INDEX.md
  • docs/testing/perspectives/src/fileHistory-test.md
  • src/dataSource.ts
  • src/fileHistory.ts
  • tests/src/dataSource.git.test.ts
  • tests/src/dataSource.test.ts
  • tests/src/fileHistory.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

File-history resolution now follows detected renames with continuation queries for older paths. It splices continuation records into the lineage and returns null when a continuation query or splice fails. Unit tests, a real-repository test, and test perspectives cover the behavior.

Changes: Rename lineage continuation

Layer / File(s) Summary
Rename lookup and continuation splicing
src/fileHistory.ts, tests/src/fileHistory.test.ts, docs/testing/perspectives/src/fileHistory-test.md
Added helpers to select the next rename and splice continuation groups at its commit. Tests and perspectives cover selection, splice results, missing commits, and unchanged inputs.
Continuation queries in file-history resolution
src/dataSource.ts, tests/src/dataSource.test.ts
getFileHistory now uses repeated lineage queries for renamed paths. Tests cover recovered history, multiple renames, query counts, and failure outcomes.
Rename-chain integration and perspective coverage
tests/src/dataSource.git.test.ts, docs/testing/perspectives/src/dataSource-test/*, docs/testing/perspectives/INDEX.md
Added a real-repository rename-chain test. Updated perspective cases, indexes, counts, and reverse-lookup mappings; translated existing S49 cases into English.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant getFileHistory
  participant queryFileHistoryLineage
  participant Git as Git history query
  participant fileHistory as Lineage helpers
  getFileHistory->>queryFileHistoryLineage: resolve lineage
  queryFileHistoryLineage->>Git: query current path lineage
  loop For each detected rename
    queryFileHistoryLineage->>fileHistory: find next rename
    queryFileHistoryLineage->>Git: query rename old path
    queryFileHistoryLineage->>fileHistory: splice continuation at rename commit
  end
  queryFileHistoryLineage-->>getFileHistory: completed lineage or null
Loading
Merge Risk: Minimal · previous review d5d65

The rename-continuation change is ready to merge after normal checks; no unresolved issue is established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving pre-rename file history for Git 2.56.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 5 files. (4 skipped: 4 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@numlia
numlia marked this pull request as ready for review October 27, 2026 15:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T16:02:51.442975Z 2243c67 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

- When another file was later renamed onto the old path, the continuation from the anchor followed that file and returned null instead of the history (seen in an existing repository; the base branch returned 16 entries)
- Accept the continuation only if the rename commit shows the old path in it, and otherwise retry it from the rename commit
- Keep starting at the anchor first so edits of the old path on another line stay included (TC-352)
- Add TC-804 (S9), TC-805 and TC-806 (S52) and TC-807 (S53), and update TC-796 for the retry
- Continue each source's case sequence and synchronize test names, comments, and perspective references.
- Correct the continuation helper signature in the perspectives to match the rename-entry parameter.
@numlia
numlia merged commit 49325b4 into main Oct 27, 2026
3 checks passed
@numlia
numlia deleted the fix/git-2-56-follow-lineage branch October 27, 2026 16:15
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.

1 participant