Patches produced with format-patch under specific config aren't applicable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patches produced with format-patch under specific config aren't applicable

Inbox
I have diff.noprefix=true on my ~/.gitconfig

    [diff]
        noprefix = true

I generate a .patch file from the last commit with

    git format-patch HEAD^

Due to noprefix=true, I get this line in the patch file

    diff --git src/filesystem/PhutilProcessQuery.php
src/filesystem/PhutilProcessQuery.php

instead of the default

    diff --git a/src/filesystem/PhutilProcessQuery.php
b/src/filesystem/PhutilProcessQuery.php

So when I try to apply that patch, I get

    $ git apply --check ./0001-my.patch
    error: filesystem/PhutilProcessQuery.php: No such file or directory

In trying to remove the a/ and b/ that apply expects, it removes src/
from the path, then fails to find filesystem/PhutilProcessQuery.php.

As a mitigation, I'm setting diff.noprefix to false, but a more robust
solution would be for the format-patch command to ignore this setting
as patches are expected to work on repos configured by different
people.

git version 2.37.3
--
Felipe



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux