git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git apply does not honor diff.noprefix config setting
@ 2018-05-19 23:18 hIpPy
  2018-05-21  2:03 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: hIpPy @ 2018-05-19 23:18 UTC (permalink / raw)
  To: Git Mailing List

If I disable mnemonic prefix,

$ git config --global diff.noprefix true

and do a round-trip of format-patch and apply,

$ 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)

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


Thanks,
Rish

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: git apply does not honor diff.noprefix config setting
  2018-05-19 23:18 git apply does not honor diff.noprefix config setting hIpPy
@ 2018-05-21  2:03 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2018-05-21  2:03 UTC (permalink / raw)
  To: hIpPy; +Cc: Git Mailing List

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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-21  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-19 23:18 git apply does not honor diff.noprefix config setting hIpPy
2018-05-21  2:03 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).