{"thread":{"id":"66494","subject":"[BUG] git diff go mad compared to diffutils","startedAt":"2026-10-09T02:38:08Z","lastAt":"2026-10-13T05:57:29Z","messageCount":2,"participants":["David Yang","Toon Claes"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"554547","messageId":"CAAXyoMPJ1P6RCRQgPpZwZjFZJW8Y07paXJD3=8LXtD3KuVnWnQ@mail.gmail.com","threadId":"66494","inReplyTo":null,"subject":"[BUG] git diff go mad compared to diffutils","fromName":"David Yang","fromEmail":"mmyangfl@gmail.com","sentAt":"2026-10-09T02:38:08Z","receivedAt":"2026-10-09T02:38:08Z","isPatch":false,"sender":{"key":"mmyangfl@gmail.com","avatar":null},"body":"Hello Git community,\n\nI'm using git 2.53.0 on Debian testing. During preparing a new version\nfor https://lore.kernel.org/all/20261001204851.2576101-3-mmyangfl@gmail.com/\n, I've noticed git generated unusual distorted patch\nhttps://github.com/yangfl/linux/commit/01e2de4664f60528dd9b4f15b5995fc5cb0e7b4f\n. As you may see, GitHub diff is distorted as well.\n\nWith diffutils 3.12 (diff -u old new) I can get nice diff file with\ndelection only, just like the v2 patch.\n\nShould this be considered a bug?\n\nThanks\n\n"},{"id":"554825","messageId":"87cxtedtx2.fsf@dev.null.iotcl.com.invalid","threadId":"66494","inReplyTo":"CAAXyoMPJ1P6RCRQgPpZwZjFZJW8Y07paXJD3=8LXtD3KuVnWnQ@mail.gmail.com","subject":"Re: [BUG] git diff go mad compared to diffutils","fromName":"Toon Claes","fromEmail":"toon@iotcl.com","sentAt":"2026-10-13T05:57:29Z","receivedAt":"2026-10-13T05:57:29Z","isPatch":false,"sender":{"key":"toon@iotcl.com","avatar":"https://avatars.githubusercontent.com/u/121621?v=4"},"body":"David Yang <mmyangfl@gmail.com> writes:\n\n> Hello Git community,\n>\n> I'm using git 2.53.0 on Debian testing. During preparing a new version\n> for https://lore.kernel.org/all/20261001204851.2576101-3-mmyangfl@gmail.com/\n> , I've noticed git generated unusual distorted patch\n> https://github.com/yangfl/linux/commit/01e2de4664f60528dd9b4f15b5995fc5cb0e7b4f\n> . As you may see, GitHub diff is distorted as well.\n>\n> With diffutils 3.12 (diff -u old new) I can get nice diff file with\n> delection only, just like the v2 patch.\n\nI think this depends on the used diff algorithm. By default git uses\n'myers', this isn't really great. If you run:\n\n   git diff --diff-algorithm=histogram \\\n     9142c2f8f84bf4eafe23e9d68b6ba016a60300c0 \\\n     01e2de4664f60528dd9b4f15b5995fc5cb0e7b4f \\\n     -- drivers/net/dsa/motorcomm/chip.c\n\nThe diff is cleaner.\n\n> Should this be considered a bug?\n\nSo I don't consider this a bug. Git is just stuck at an ancient default\nalgorithm. \n\n-- \nLaters,\nToon\n\n"}]}