git.vger.kernel.org archive mirror
 help / color / mirror / 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	[thread overview]
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	other threads:[~2020-02-22 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21 17:14 Getting clean diff data from git-mailinfo 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
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;
as well as URLs for NNTP newsgroup(s).