Skip to content

feat(git): add --rename-threshold option to DiffviewOpen and DiffviewFileHistory (#301) - #304

Merged
dlyongemallo merged 1 commit into
mainfrom
301-rename_threshold
Aug 17, 2026
Merged

feat(git): add --rename-threshold option to DiffviewOpen and DiffviewFileHistory (#301)#304
dlyongemallo merged 1 commit into
mainfrom
301-rename_threshold

Conversation

@dlyongemallo

@dlyongemallo dlyongemallo commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Closes #301.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a --rename-threshold={n} CLI option to :DiffviewOpen and :DiffviewFileHistory, letting users override the global rename_threshold config on a per-view basis for git's rename detection (-M<n>%). I traced the full data flow end-to-end for both entry points and it is wired correctly and backward compatible (the new value always falls back to the global config when absent).

Changes:

  • Adds parse_rename_threshold_flag (git adapter) that validates the flag via the shared config.validate.integer helper (accepts 40/40%, range 0–100, warns and falls back on invalid input), wires it into diffview_options/file_history_options, and threads it through tracked_files and stream_fh_data; registers completion.
  • Forwards the value per-view via DiffViewOptions.rename_thresholdLayoutOpt.rename_thresholdtracked_files, and via GitLogOptions.rename_threshold → file-history stream.
  • Emits a warning for Jujutsu (unsupported), exports config.validate, and documents the option; adds functional tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lua/diffview/vcs/adapters/git/init.lua Parses/validates the flag and applies -M<n>% in file-listing and history paths; adds completion.
lua/diffview/vcs/utils.lua Forwards dv_opt.rename_threshold into the per-view opt for tracked_files.
lua/diffview/vcs/adapter.lua Adds rename_threshold to LayoutOpt type.
lua/diffview/scene/views/diff/diff_view.lua Adds rename_threshold to DiffViewOptions type.
lua/diffview/config.lua Adds rename_threshold to git log-option schema/defaults; exports validate.
lua/diffview/vcs/adapters/jj/init.lua Warns that the option is unsupported for Jujutsu.
lua/diffview/tests/functional/git_adapter_spec.lua Tests parsing for open and file-history options.
doc/diffview.txt Documents the new option for both commands.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dlyongemallo
dlyongemallo merged commit 11a187e into main Aug 17, 2026
9 checks passed
@dlyongemallo
dlyongemallo deleted the 301-rename_threshold branch August 17, 2026 10: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.

feature request: enable setting rename threshold as diffview command option

2 participants