{"thread":{"id":"48526","subject":"git apply does not honor diff.noprefix config setting","startedAt":"2018-05-19T23:19:58Z","lastAt":"2018-05-21T02:03:14Z","messageCount":2,"participants":["hIpPy","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"348080","messageId":"CAM_JFCza0Az32RC-ytu_6PxG9JnteySPEDyKEeDzZAv9MdadAQ@mail.gmail.com","threadId":"48526","inReplyTo":null,"subject":"git apply does not honor diff.noprefix config setting","fromName":"hIpPy","fromEmail":"hippy2981@gmail.com","sentAt":"2018-05-19T23:18:42Z","receivedAt":"2018-05-19T23:19:58Z","isPatch":false,"sender":{"key":"hippy2981@gmail.com","avatar":"https://gravatar.com/avatar/00812eff6e91f90d2c1fe2faccef22d7c475073a1f5b7467152d5174fa61e0cb?d=mp&s=160"},"body":"If I disable mnemonic prefix,\n\n$ git config --global diff.noprefix true\n\nand do a round-trip of format-patch and apply,\n\n$ git format-patch -1 @\n$ git apply <some-file.patch>\n\ngit apply fails with,\n\nerror: git diff header lacks filename information when removing 1\nleading pathname component (line 16)\n\nWithout 'diff.noprefix' config setting, git apply works. It seems git\napply does not honor the diff.noprefix config setting.\n\n\nThanks,\nRish\n"},{"id":"348162","messageId":"xmqqefi53gva.fsf@gitster-ct.c.googlers.com","threadId":"48526","inReplyTo":"CAM_JFCza0Az32RC-ytu_6PxG9JnteySPEDyKEeDzZAv9MdadAQ@mail.gmail.com","subject":"Re: git apply does not honor diff.noprefix config setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-21T02:03:05Z","receivedAt":"2018-05-21T02:03:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"hIpPy <hippy2981@gmail.com> writes:\n\n> If I disable mnemonic prefix,\n>\n> $ git config --global diff.noprefix true\n>\n> and do a round-trip of format-patch and apply,\n\nSetting diff.noprefix does not disable \"mnemonic prefix\".  It asks\n\"diff\" family of commands to use no prefix, not even the normal,\nnon-mnemonic, prefix.\n\n> $ git format-patch -1 @\n> $ git apply <some-file.patch>\n>\n> git apply fails with,\n>\n> error: git diff header lacks filename information when removing 1\n> leading pathname component (line 16)\n\nTotally expected.\n\n> Without 'diff.noprefix' config setting, git apply works. It seems git\n> apply does not honor the diff.noprefix config setting.\n\nYes, and because \"diff\" and \"format-patch\" are for producers of, and\n\"apply\" and \"am\" are for consumers of a patch, which are likely to\nbe different people, \"apply\" or \"am\" should never pay attention to\n\"diff.noprefix\".\n\nIt is a different issue if we should have\n\n - format-patch.noprefix, which defaults to the same as\n   diff.noprefix, but allows people to configure \"format-patch\"\n   differently from \"diff\" and \"show\"\n\n - am.pvalue, which defaults to 1, but can be set to e.g. 0 to\n   accept format-patch output from those who set\n   format-patch.noprefix to true\n\nI haven't thought things through, but offhand I do not see why we\nshouldn't.  But I am reasonably firm on that diff.noprefix should\nnever affect anything on the \"apply/am\" side.\n\n\n\n\n"}]}