[PATCH] apply: clarify "-p" documentation
From: Jeff King <hidden>
Date: 2018-05-10 14:29:28
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
On Fri, Apr 27, 2018 at 12:40:05PM -0500, kelly elton wrote:
quoted
-p<n> Remove <n> leading slashes from traditional diff paths. The default is 1.This suggests to me the following outcomes: 1) home/user/repos/myrepo with -p1 becomes home/user/repos/myrepo 2) home/user/repos/myrepo with -p2 becomes home/user/repos/myrepo 3) /home/user/repos/myrepo with -p1 becomes home/user/repos/myrepo 4) /home/user/repos/myrepo with -p2 becomes home/user/repos/myrepo 5) //home/user/repos/myrepo with -p1 becomes /home/user/repos/myrepo 6) //home/user/repos/myrepo with -p2 becomes home/user/repos/myrepo `Remove <n> leading slashes`...That's not really what's happening. What seems to actually happen is that it is removing directories from the path: 1) home/user/repos/myrepo with -p1 becomes home/user/repos/myrepo 2) home/user/repos/myrepo with -p2 becomes user/repos/myrepo This argument seems to be removing folders from the path, not slashes.
Yes. I agree the current documentation is quite misleading. How about this? -- >8 -- Subject: [PATCH] apply: clarify "-p" documentation We're not really removing slashes, but slash-separated path components. Let's make that more clear. Reported-by: kelly elton <redacted> Signed-off-by: Jeff King <redacted> --- Documentation/git-apply.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index 4ebc3d3271..c993fbf714 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt@@ -113,8 +113,10 @@ explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). -p<n>:: - Remove <n> leading slashes from traditional diff paths. The - default is 1. + Remove <n> leading path components (separated by slashes) from + traditional diff paths. E.g., with `-p2`, a patch against + `a/dir/file` will be applied directly to `file`. The default is + 1. -C<n>:: Ensure at least <n> lines of surrounding context match before
--
2.17.0.984.g9b00a423a4