Re: git-apply(1): error: content/en/ports/_index.adoc: No such file or directory

From: Yuri <yuri_at_aetern.org>
Date: Sat, 25 Mar 2023 20:34:50 UTC
Graham Perrin wrote:
> Can anyone explain what's below?
> 
> The .diff is downloaded from <https://reviews.freebsd.org/D38510>.
> 
> 
> % file /usr/doc/website/content/en/ports/_index.adoc
> /usr/doc/website/content/en/ports/_index.adoc: ASCII text
> % git -C /usr/doc apply -v /tmp/D38510.diff
> Checking patch content/en/ports/_index.adoc...
> error: content/en/ports/_index.adoc: No such file or directory
> % head -n 8 /tmp/D38510.diff
> Index: website/content/en/ports/_index.adoc
> ===================================================================
> --- website/content/en/ports/_index.adoc
> +++ website/content/en/ports/_index.adoc
> @@ -11,21 +11,20 @@
> 
> '''''
> 
> %
> 

The default value for stripping leading path components is 1, as usually
the diff looks like:

--- a/path/to/file
+++ b/path/to/file

...and it's not there in the diff you are trying to apply.

IOW, try specifying -p0.