Skip to content

Diff includes merge-commit noise from main, inflating file count #19

Description

@benthomasson

Problem

When a feature branch has been rebased or contains merge commits from main, git diff main...feature-branch includes all those merged files in the diff. This causes the review to process hundreds of files that are not part of the actual feature change.

Example

MR !340 (feature/runtime-model-fallback) on agents-python:

  • git diff --stat main...feature/runtime-model-fallback shows 377 files changed, 41,829 insertions
  • git diff --stat dc8f17b98^..a79d3f913 (feature commits only) shows 9 files changed, 750 insertions

The 377/41k number is merge noise. The review should only see the 9/750.

Suggested Fix

Use git merge-base main feature-branch to find the true fork point, or allow the user to specify a commit range (--from-commit). GitLab MRs expose diff_refs.base_sha which gives the correct base.

Alternatively, detect when the diff is dominated by merge commits and warn the user.

Related

This caused issue #18 -- the inflated diff was what made the review stall.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions