Re: [PATCH] apply: when -R, also reverse list of sections

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> I wish you told that to those who added fn_table kludge to apply.c
> back when they did so.  They apparently wanted to have a patch that
> has more than one "diff --git a/hello.c b/hello.c" that talks about
> the same file applied with a single invocation of "git apply".
> Perhaps what they did is already broken with "apply -R", and blind
> reversal of everything magically makes it work?  Or what they did
> already works with "apply -R" and your blind reversal would break,
> unless you undo what they did?

;-)  It turns out that it was the former.

Without your "blindly reverse everything" patch, the attached patch
illustrates how the "touch the same path more than once" support
introduced in 7a07841c (git-apply: handle a patch that touches the
same path more than once better, 2008-06-27) is broken with respect
to "apply -R".

So, you should be able to sell the change to fix _two_ bugs ;-)

Thanks.

diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
index 972946c174..fa824ac09f 100755
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -30,7 +30,7 @@ test_expect_success 'apply same filename with independent changes' '
 	test_cmp same_fn same_fn2
 '
 
-test_expect_success 'apply same filename with overlapping changes' '
+test_expect_failure 'apply same filename with overlapping changes' '
 	git reset --hard &&
 	modify "s/^d/z/" same_fn &&
 	git diff > patch0 &&
@@ -39,8 +39,13 @@ test_expect_success 'apply same filename with overlapping changes' '
 	git diff >> patch0 &&
 	cp same_fn same_fn2 &&
 	git reset --hard &&
+	cp same_fn same_fn1 &&
+
 	git apply patch0 &&
-	test_cmp same_fn same_fn2
+	test_cmp same_fn same_fn2 &&
+
+	git apply -R patch0 &&
+	test_cmp same_fn same_fn1
 '
 
 test_expect_success 'apply same new filename after rename' '



[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