Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Fix git-apply with -p greater than 1

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:51

Jonathan Nieder [off-list ref] writes:
Junio C Hamano wrote:
quoted
+test_expect_success 'apply (-p2) diff, mode change only' '
+	cat >patch.chmod <<-\EOF &&
+	diff --git a/sub/file1 b/sub/file1
+	old mode 100644
+	new mode 100755
+	EOF
+	chmod 644 file1 &&
+	git apply -p2 patch.chmod &&
+	test -x file1
I had thought -p was only supposed to apply to traditional patches.
You are correct that historically it was invented for use with non-git
patches, but I didn't think of a good reason why we should forbid it
offhand.
Maybe a documentation update would avoid confusion?

	-p<n>
	   Remove <n> leading slashes from traditional diff paths.
	   The default is 1.
If we have a good reason to forbid this option on git generated patches,
perhaps yes, and with either error/warning codepath, but first lets find
out a good reason why we should forbid it.  There may indeed be some.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help