Skip to content

fix(gix-diff): apply the rewrite limit to each side like Git - #3062

Merged
Sebastian Thiel (Byron) merged 3 commits into
GitoxideLabs:mainfrom
hashhar:hashhar/rename-limit
Oct 15, 2026
Merged

Sebastian Thiel (Byron) merged 3 commits into
GitoxideLabs:mainfrom
hashhar:hashhar/rename-limit

Conversation

@hashhar

@hashhar hashhar commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Rewrites::limit compared the combination count against the unsquared limit so similarity tracking didn't match git's diff.renameLimit behaviour or the docs.

This cause was discovered by an AI agent (Claude Code Opus5.5) but the fix and tests are mine.

jj's copy tracking uses the default limit of 1000 so a diff that moves some edited files gets no similarity-based renames. In my case I had a package move with 32 deleted and 34 added files which is 1088 combinations. git diff -M50% paired 31 of them. gix didn't pair any of them but reported 1312 skipped checks.
After this change and jj's rename options gix gives same pairings as Git.

Rewrites::limit compared the combination count against the unsquared
limit so similarity tracking didn't match git's diff.renameLimit
behaviour or the docs.
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Contributor

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-14T22:41:15.041854Z e571a92 PR opened
ℹ️ About Codex in GitHub

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

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e571a92732

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment thread gix-diff/src/rewrites/tracker.rs Outdated
Addressed CI review comment. Besides that the change seemed fine and passed.

<!-- agent -->
**Compare squared limits without saturating both products**

On the supported 32-bit targets, when `limit` exceeds 65,535 and both candidate
counts are just above that limit (for example, 70,001 sources and destinations
with a limit of 70,000), both multiplications saturate to `usize::MAX`; the `>`
comparison is therefore false and fuzzy matching runs billions of comparisons
even though the true product exceeds `limit²`. Use a wider or otherwise
overflow-free comparison for the gate, while retaining a saturated value only
for the outcome statistic.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
<!-- agent -->
`cargo deny --workspace --all-features check advisories` rejects the locked
`rustls` 0.23.45 used by the Reqwest and Curl HTTP transport backends:

- `RUSTSEC-2026-0346`: client session `Debug` output can expose TLS secrets.
- `RUSTSEC-2026-0347`: buffered application data can reach the outer server
  after Encrypted Client Hello rejection.
- `RUSTSEC-2026-0348`: Brotli certificate decompression can allocate up to
  1 GiB before authentication.
- `RUSTSEC-2026-0349`: an unauthenticated `ServerHello` can downgrade key
  exchange on subsequent connections.

Update only `rustls` and its checksum in `Cargo.lock` to the patched 0.23.46
release. Existing dependency requirements accept this patch without manifest
changes or advisory exceptions.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@Byron

Byron commented Oct 15, 2026

Copy link
Copy Markdown
Member

Thanks a lot, great catch!

@Byron
Sebastian Thiel (Byron) merged commit d568e8b into GitoxideLabs:main Oct 15, 2026
33 checks passed
@hashhar
Ashhar Hasan (hashhar) deleted the hashhar/rename-limit branch October 15, 2026 03:34
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