git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Laurent Arnoud <laurent@spkdev.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] format-patch: generate valid patch with diff.noprefix config
Date: Thu, 04 Jun 2020 13:18:57 -0700	[thread overview]
Message-ID: <xmqq367aposu.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200604193238.GA1911544@spk-laptop> (Laurent Arnoud's message of "Thu, 4 Jun 2020 21:32:38 +0200")

Laurent Arnoud <laurent@spkdev.net> writes:

> I don't know if its a bug but I founded strange that I needed to use an alias
> "git -c diff.noprefix=false format-patch" to generate a patch that I can apply
> directly with "git am".

The same thing can be said about the diff.relative option.

As I do not use either of these variables myself, I am somewhat
indifferent, if those who set these variables find the consequences
of doing so unpleasant.  As people often say, if it hurts, then...
;-)

Because the recipient of format-patch output who consumes it is
typically different from the one who generates it, it probably does
not make much sense to attempt linking diff.noprefix=true with the
-p0 option (there isn't even a configuration for 'git am -p<num>',
if I am not mistaken).

Depending on the project a user works with, allowing
log/show/format-patch to honor certain diff.* configuration
variables, without a way to countermand them with more specific
configuration for log/show/format-patch, may smell like a bug.  

I am not sure where to draw the line, though.  Would we treat only
format-patch and no other commands in the log family specially?
Would we treat each commands in the log family specially and
separately, so that you could say "diff and show uses noprefix, but
'log -p' and 'whatchanged' uses the standard a/ and b/ prefix and
format-patch uses old/ and new/ prefix" independently?

> I didn't know the -p option but to send a patch to a
> mailinglist it should have the prefix I guess ?

The participants in this project would certainly find it unusual
when they see a prefix-less patch.

There probably are projects older than Git whose convention is to
use .noprefix; we didn't want to force them to switch and instead
accomodated their preference with .noprefix but in hindsight, it may
have been a better idea to force one true way to everybody, which
would have kept the world simpler.  I dunno.



  reply	other threads:[~2020-06-04 20:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 20:49 [PATCH] format-patch: generate valid patch with diff.noprefix config Laurent Arnoud
2020-06-02 21:12 ` Junio C Hamano
2020-06-02 21:33   ` Laurent Arnoud
2020-06-02 22:09   ` Junio C Hamano
2020-06-04 19:32     ` Laurent Arnoud
2020-06-04 20:18       ` Junio C Hamano [this message]
2020-06-04 23:26         ` Đoàn Trần Công Danh

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=xmqq367aposu.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=laurent@spkdev.net \
    /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).