Skip to content

Conversation

@KEY60228
Copy link
Owner

Summary

Enable three-dot diff (merge-base comparison) when comparing working tree against a specific ref

Changes

  • Add get_merge_base() function to find the common ancestor between HEAD and a reference
  • Update get_diff_files() to use merge base when comparing working tree against a ref
  • Configure alt-diffview to use --merge-base option for accurate comparison
  • Add warning for diffview.nvim users about two-dot diff limitation
  • Fix typo in review start message (double dots to triple dots)

Motivation

When reviewing changes against a base branch (e.g., main), users typically want to see only the changes introduced in their current branch, not all differences between branches. This PR implements three-dot diff behavior (base...HEAD) instead of two-dot diff (base..HEAD) when comparing the working tree against a reference.

Technical Details

  • For alt-diffview users: Utilizes the --merge-base option for accurate three-dot comparison
  • For diffview.nvim users: Shows a warning since it doesn't support merge-base comparison
  • The merge base calculation only applies when comparing working tree against a ref (not for ref-to-ref comparisons)

Testing

  • Tested with alt-diffview: correctly shows only branch changes
  • Tested with diffview.nvim: warning displayed, falls back to two-dot diff
  • Verified merge base calculation works correctly
  • Existing ref-to-ref comparisons remain unchanged

@KEY60228 KEY60228 self-assigned this Jul 14, 2025
@KEY60228 KEY60228 merged commit 27d8055 into main Jul 14, 2025
@KEY60228 KEY60228 deleted the feat/merge-base-comparison branch July 14, 2025 17:51
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