Skip to content

Show rename origin and render rename-aware diffs #222

Closed

Description

@aldobrynin

Problem

When reviewing a renamed file, revdiff shows only the new filename. In staged rename cases, the diff can also render the file as entirely added/changed instead of showing only the actual line changes.

This makes rename reviews noisy and hides important context: reviewers cannot see old/path -> new/path, and content-preserving or lightly edited renames appear much larger than they are.

Reproduction

git init
git config user.email [email protected]
git config user.name Test

printf 'one\ntwo\nthree\n' > old.txt
git add old.txt
git commit -m init

git mv old.txt new.txt
perl -0pi -e 's/two/TWO/' new.txt
git add new.txt

revdiff --staged

Current behavior

  • The file tree marks the entry as renamed with R.
  • The TUI shows only the new path/name; it does not show the origin path (old -> new) anywhere obvious.
  • In staged rename cases, the diff can render as a new file with all lines added/changed, because revdiff asks Git for only the new path.

Expected behavior

  • The rename origin should be visible somewhere in the file view, at minimum in the diff pane header, e.g. old/path.go -> new/path.go.
  • The file tree can keep the compact R new/path.go display if showing both paths there would be too wide.
  • The diff should be rename-aware and show only actual content changes.
   one
  -two
  +TWO
   three

Activity

  1. umputun commented on Jun 6, 2026

    @umputun
    Owner

    fixed in #223 (merged to master). Renamed files now diff against their origin instead of showing every line as added, and the diff pane header shows old → new.

    works across --staged, single-ref, and two-ref git modes. The root cause was the per-file git diff -- <newpath> stripping the old side before git could pair the rename. Rename detection is now forced with -M, so it works regardless of your diff.renames config.

    the file tree keeps the compact R new/path, the origin shows in the diff header as you suggested.

    hg and jj don't report a rename origin today, so rename-aware display for those is a separate follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions