Skip to content

blame: add blame.rename* configuration#894

Merged
dscho merged 1 commit intomicrosoft:vfs-2.53.0from
tyrielv:tyrielv/blame-rename-fix
Apr 22, 2026
Merged

blame: add blame.rename* configuration#894
dscho merged 1 commit intomicrosoft:vfs-2.53.0from
tyrielv:tyrielv/blame-rename-fix

Conversation

@tyrielv
Copy link
Copy Markdown

@tyrielv tyrielv commented Apr 20, 2026

blame's config callback did not load diff.renameThreshold because it chained directly to git_default_config, skipping git_diff_basic_config (and git_diff_ui_config) where that setting is handled. As a result, repo_diff_setup() always saw a zero rename_score, and blame fell back to DEFAULT_RENAME_SCORE (50%) regardless of the configured threshold.

This PR moves diff.renameThreshold from git_diff_ui_config to git_diff_basic_config, alongside the related diff.renameLimit setting, so that plumbing commands that use git_diff_basic_config can also pick it up - but instead of trying to import that for blame, this PR adds separate configuration for blame.renames, blame.renameThreshold, and blame.renameLimit

Assisted-by: Claude Opus 4.6

Comment thread builtin/blame.c Outdated
@tyrielv tyrielv force-pushed the tyrielv/blame-rename-fix branch 4 times, most recently from 3719f55 to 1f227c2 Compare April 21, 2026 16:13
@tyrielv tyrielv changed the title blame: teach git_blame_config about diff.renameThreshold blame: add blame.rename* configuration Apr 21, 2026
@tyrielv tyrielv force-pushed the tyrielv/blame-rename-fix branch from 1f227c2 to 2f2b9df Compare April 21, 2026 16:23
@tyrielv tyrielv marked this pull request as ready for review April 21, 2026 16:45
Comment thread builtin/blame.c
Copy link
Copy Markdown

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

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

Looks good. I think you need to update your PR description to match the latest changes.

Also, this seems like something that should go upstream eventually. It's good to fast-track to microsoft/git, but just keep in mind that the config key names may need to change during the upstream review.

Add blame-specific configuration options for rename detection:

  - blame.renames: disable rename following (defaults to true)
  - blame.renameThreshold: minimum similarity for rename detection
  - blame.renameLimit: limit on rename detection candidates

These are independent of the diff.renames/renameThreshold/renameLimit
settings, which blame does not read because its config callback chains
to git_default_config rather than git_diff_basic_config.

The threshold and limit options forward to git_diff_basic_config to
set the same globals that repo_diff_setup() copies into diff_options,
following the existing pattern used for diff.algorithm.

Also move diff.renameThreshold from git_diff_ui_config to
git_diff_basic_config, alongside the related diff.renameLimit, since
it controls rename detection behavior rather than UI presentation.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv tyrielv force-pushed the tyrielv/blame-rename-fix branch from 2f2b9df to 92725e7 Compare April 21, 2026 19:18
Copy link
Copy Markdown
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

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

Let's merge this! Thank you for your swift fix!

@dscho dscho merged commit 10c0f35 into microsoft:vfs-2.53.0 Apr 22, 2026
66 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.

3 participants