Skip to content

feat: support drag-and-drop pairing of renamed files in webdiff#396

Merged
jrfaller merged 1 commit intoGumTreeDiff:mainfrom
JonahSussman:335
Mar 6, 2026
Merged

feat: support drag-and-drop pairing of renamed files in webdiff#396
jrfaller merged 1 commit intoGumTreeDiff:mainfrom
JonahSussman:335

Conversation

@JonahSussman
Copy link
Contributor

Implements #335.

When comparing directories, renamed files appear as separate "deleted" and "added" entries with no way to compare them. This PR adds drag-and-drop support in the webdiff directory list view so users can manually pair renamed files for comparison.

Before

Renamed files (OldName.java -> NewName.java) show up as unrelated deleted/added entries:

01-before

After

Drag a file from the Deleted section onto a file in the Added section (or vice versa) to pair them. Paired files appear in the Modified section as OldName.java -> NewName.java with all diff viewers available, plus an "unpair" button to reverse the operation:

02-after-pair

Clicking any diff viewer on the paired entry works as expected:

03-diff-view

Changes

  • DirectoryComparator - Added pairFiles() and unpairFiles() methods
  • WebDiff - Added POST /pair-files and POST /unpair-files endpoints
  • DirectoryDiffView - Drag-and-drop attributes on deleted/added rows, rename display (old → new), unpair button; also fixed added files being relativized against the wrong root directory
  • dragdrop.js (new) - Client-side HTML5 drag-and-drop handling
  • TestDirectoryComparator - Added tests for pair/unpair logic and invalid argument handling

…ements GumTreeDiff#335.

Signed-off-by: JonahSussman <sussmanjonah@gmail.com>
@jrfaller
Copy link
Member

jrfaller commented Mar 6, 2026

Hi! Thanks a lot for the PR. The patch looks good to me. I will see what the pipeline says! Cheers.

@jrfaller jrfaller merged commit f596953 into GumTreeDiff:main Mar 6, 2026
2 checks passed
@JonahSussman
Copy link
Contributor Author

@jrfaller No problem, glad I could help out!

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