Re: Bug: With diff.noprefix=true, `git format-patch` creates a patch that `git am` rejects

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

 



On 2022-01-07 16:36:27-0800, Keith Thompson wrote:
> The details: I had this in my $HOME/.gitconfig:
> 
> [diff]
>         noprefix = true
> 
> This caused `git format-patch` *not* to generate the `a/` and `b/`
> prefixes in the patch file.  Setting "noprefix = false" works around
> the problem.
> 
> Here are the first few lines of the resulting patch file:
> ===
> cat 0001-Fix-documented-argv-and-envp-params-for-posix_spawn.patch,000
> >From f4a41189d86bc208a90e754387294b9c4c11cdfc Mon Sep 17 00:00:00 2001
> From: Keith Thompson <Keith.S.Thompson@xxxxxxxxx>
> Date: Wed, 5 Jan 2022 13:30:16 -0800
> Subject: [PATCH] Fix documented argv and envp params for posix_spawn
> 
> ---
>  newlib/libc/posix/posix_spawn.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git newlib/libc/posix/posix_spawn.c newlib/libc/posix/posix_spawn.c
> index 005471fde..85bfa6477 100644
> --- newlib/libc/posix/posix_spawn.c
> +++ newlib/libc/posix/posix_spawn.c
> ===
> 
> Feeding this patch to `git am` caused it to strip the `newlib/`
> prefix from the file name.  There doesn't seem to be a way to coax
> `git format-patch` to ignore the current diff.noprefix setting,
> or `git am` to tolerate the missing prefixes.

The -p<num> flag controls how many segments `git am` or `git apply`
removes. The default is -p1. `git am -p0` should apply the patch
correctly.



[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