Thread (1 message) 1 message, 1 author, 2018-05-21

Re: git apply does not honor diff.noprefix config setting

From: Junio C Hamano <hidden>
Date: 2018-05-21 02:03:14

hIpPy [off-list ref] 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.



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help