Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: git@vger.kernel.org
Subject: Re: Getting clean diff data from git-mailinfo
Date: Sat, 22 Feb 2020 08:56:08 -0800
Message-ID: <xmqqftf27e8n.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <xmqqk14e7emp.fsf@gitster-ct.c.googlers.com> (Junio C. Hamano's message of "Sat, 22 Feb 2020 08:47:42 -0800")

Junio C Hamano <gitster@pobox.com> 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.

Thanks.


[Footnote]

*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:
  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=xmqqftf27e8n.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=konstantin@linuxfoundation.org \
    /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

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 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/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git