From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Laurent Arnoud <laurent@spkdev.net>, git@vger.kernel.org
Subject: Re: [PATCH] format-patch: generate valid patch with diff.noprefix config
Date: Fri, 5 Jun 2020 06:26:19 +0700 [thread overview]
Message-ID: <20200604232619.GA6329@danh.dev> (raw)
In-Reply-To: <xmqq367aposu.fsf@gitster.c.googlers.com>
On 2020-06-04 13:18:57-0700, Junio C Hamano <gitster@pobox.com> wrote:
> 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...
> ;-)
FWIW, people need to dig into git-config(1) to know diff.noprefix
We don't mention it in git-diff(1). Me neither until today.
> 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).
Could we extend the patch in someway that can hint git-am(1) to
use "-p0" if patch was generated by --no-prefix?
I couldn't come up with any idea right now, since all parts of the
patch is very busy with a lot of information.
An RFC 822 header, perhap?
Of course old git-am(1) couldn't understand the extension.
And the new git-am may come up with false positive?
> 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.
I do use format-patch --no-prefix.
It's unlikely that I will use diff.noprefix, though.
I think other people also have different preferences.
--
Danh
prev parent reply other threads:[~2020-06-04 23:26 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
2020-06-04 23:26 ` Đoàn Trần Công Danh [this message]
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=20200604232619.GA6329@danh.dev \
--to=congdanhqx@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.