Git development
 help / color / mirror / Atom feed
From: Toon Claes <toon@iotcl.com>
To: David Yang <mmyangfl@gmail.com>, git@vger.kernel.org
Subject: Re: [BUG] git diff go mad compared to diffutils
Date: Tue, 13 Oct 2026 07:57:29 +0200	[thread overview]
Message-ID: <87cxtedtx2.fsf@dev.null.iotcl.com.invalid> (raw)
In-Reply-To: <CAAXyoMPJ1P6RCRQgPpZwZjFZJW8Y07paXJD3=8LXtD3KuVnWnQ@mail.gmail.com>

David Yang <mmyangfl@gmail.com> writes:

> Hello Git community,
>
> I'm using git 2.53.0 on Debian testing. During preparing a new version
> for https://lore.kernel.org/all/20261001204851.2576101-3-mmyangfl@gmail.com/
> , I've noticed git generated unusual distorted patch
> https://github.com/yangfl/linux/commit/01e2de4664f60528dd9b4f15b5995fc5cb0e7b4f
> . As you may see, GitHub diff is distorted as well.
>
> With diffutils 3.12 (diff -u old new) I can get nice diff file with
> delection only, just like the v2 patch.

I think this depends on the used diff algorithm. By default git uses
'myers', this isn't really great. If you run:

   git diff --diff-algorithm=histogram \
     9142c2f8f84bf4eafe23e9d68b6ba016a60300c0 \
     01e2de4664f60528dd9b4f15b5995fc5cb0e7b4f \
     -- drivers/net/dsa/motorcomm/chip.c

The diff is cleaner.

> Should this be considered a bug?

So I don't consider this a bug. Git is just stuck at an ancient default
algorithm. 

-- 
Laters,
Toon

      reply	other threads:[~2026-10-13  5:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  2:38 [BUG] git diff go mad compared to diffutils David Yang
2026-10-13  5:57 ` Toon Claes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cxtedtx2.fsf@dev.null.iotcl.com.invalid \
    --to=toon@iotcl.com \
    --cc=git@vger.kernel.org \
    --cc=mmyangfl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox