Git Mailing List Archive on
 help / color / Atom feed
From: Junio C Hamano <>
To: Konstantin Ryabitsev <>
Subject: Re: Getting clean diff data from git-mailinfo
Date: Sat, 22 Feb 2020 08:56:08 -0800
Message-ID: <> (raw)
In-Reply-To: <> (Junio C. Hamano's message of "Sat, 22 Feb 2020 08:47:42 -0800")

Junio C Hamano <> writes:

> ... then we may have had split (3) into three pieces:
>  (3a) material before the pure diff (e.g. diffstat, etc.)
>  (3b) pure diff
>  (3c) trailing junk (e.g. base-commit info, e-mail signature, etc.)
> ...
> So, because there is no such need so far, there is no tool in the
> Git toolbox to split (3) into three pieces.
> You're welcome to write one, but the current toolset does not need
> it.

Writing something that reads (3), discarding lines before the first
"diff --git", counting lines that appear on "@@ ... @@" line while
copying it to the output, repeating the process when you see
something other than "diff --git" (i.e. beginning of the patch for
the next path) or "@@ ... @@" (i.e. another hunk in the patch for
the current path), and discarding the rest may be trivial.

But in practice, people edit their diff [*1*], forgetting the line
counts on the "@@ ... @@" lines, and it helps the maintainer to have
the whole (3), not only (3b), in a single file to recover from such
a broken patch submission.

So adding another tool to produce (3b) only is fine, but an attempt
to get rid of (3) and to claim that (3b) replaces the need for (3)
is highly discouraged.



*1* Even when people edit without changing the line numbers (imagine
    a typofix on a '+' line), I saw that "patch" mode of Emacs broke
    the line count on "@@ ...@@" line of the last hunk when the
    patch ends with certain patterns.

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21 17:14 Konstantin Ryabitsev
2020-02-22 16:47 ` Junio C Hamano
2020-02-22 16:56   ` Junio C Hamano [this message]
2020-02-22 18:00     ` Andreas Schwab

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:

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

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Mailing List Archive on

Archives are clonable:
	git clone --mirror git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ \
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone