git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: hIpPy <hippy2981@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: git apply does not honor diff.noprefix config setting
Date: Mon, 21 May 2018 11:03:05 +0900	[thread overview]
Message-ID: <xmqqefi53gva.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <CAM_JFCza0Az32RC-ytu_6PxG9JnteySPEDyKEeDzZAv9MdadAQ@mail.gmail.com> (hIpPy's message of "Sat, 19 May 2018 16:18:42 -0700")

hIpPy <hippy2981@gmail.com> writes:

> If I disable mnemonic prefix,
>
> $ git config --global diff.noprefix true
>
> and do a round-trip of format-patch and apply,

Setting diff.noprefix does not disable "mnemonic prefix".  It asks
"diff" family of commands to use no prefix, not even the normal,
non-mnemonic, prefix.

> $ git format-patch -1 @
> $ git apply <some-file.patch>
>
> git apply fails with,
>
> error: git diff header lacks filename information when removing 1
> leading pathname component (line 16)

Totally expected.

> Without 'diff.noprefix' config setting, git apply works. It seems git
> apply does not honor the diff.noprefix config setting.

Yes, and because "diff" and "format-patch" are for producers of, and
"apply" and "am" are for consumers of a patch, which are likely to
be different people, "apply" or "am" should never pay attention to
"diff.noprefix".

It is a different issue if we should have

 - format-patch.noprefix, which defaults to the same as
   diff.noprefix, but allows people to configure "format-patch"
   differently from "diff" and "show"

 - am.pvalue, which defaults to 1, but can be set to e.g. 0 to
   accept format-patch output from those who set
   format-patch.noprefix to true

I haven't thought things through, but offhand I do not see why we
shouldn't.  But I am reasonably firm on that diff.noprefix should
never affect anything on the "apply/am" side.





      reply	other threads:[~2018-05-21  2:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-19 23:18 git apply does not honor diff.noprefix config setting hIpPy
2018-05-21  2:03 ` Junio C Hamano [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=xmqqefi53gva.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hippy2981@gmail.com \
    /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).