Re: [PATCH 1/3] patch-id: make it stable against hunk reordering

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

 



On Thu, Mar 27, 2014 at 09:58:41AM -0700, Junio C Hamano wrote:
> "Michael S. Tsirkin" <mst@xxxxxxxxxx> writes:
> 
> > Patch id changes if you reorder hunks in a diff.
> 
> If you reorder hunks, the patch should no longer apply [*1*], so a
> feature to make patch-id stable across such move would have no
> practical use ;-), but I am guessing you meant something else.
> 
> Perhaps this is about using "-O <orderfile>" option, even though you
> happened to have implemented the id mixing at per-hunk level?
> 
> 
> [Footnote]
> 
> *1* It has been a long time since I looked at the code, and I do not
> know offhand if "git apply" has such a bug not to diagnose a hunk
> for a file for an earlier part that comes later in its input stream
> after seeing another hunk for the same file as a bug. If it does
> not, perhaps we should.

I started to remove that code, but then I recalled why I did it like
this.  There is a good reason.  Yes, you can't simply reorder hunks just
like this.  But you can get the same effect by prefixing the header:



--- x.txt	2014-03-27 19:31:18.166115449 +0200
+++ y.txt	2014-03-27 19:31:46.731116998 +0200
@@ -30,8 +31,6 @@ a
 a
 a
 a
-a
-b
 b
 b
 b
@@ -60,6 +59,7 @@ b
 b
 b
 b
+Y
 b
 b
 b
--- x.txt	2014-03-27 19:31:18.166115449 +0200
+++ y.txt	2014-03-27 19:31:46.731116998 +0200
@@ -11,6 +11,7 @@ a
 a
 a
 a
+X
 a
 a
 a


Is equivalent to 

--- x.txt	2014-03-27 19:31:18.166115449 +0200
+++ y.txt	2014-03-27 19:31:46.731116998 +0200
@@ -30,8 +31,6 @@ a
 a
 a
 a
-a
-b
 b
 b
 b
@@ -60,6 +59,7 @@ b
 b
 b
 b
+Y
 b
 b
 b
--- x.txt	2014-03-27 19:31:18.166115449 +0200
+++ y.txt	2014-03-27 19:31:46.731116998 +0200
@@ -11,6 +11,7 @@ a
 a
 a
 a
+X
 a
 a
 a


And this works fine with regular tools like patch
so I think it should work for git too, anything else
would be surprising.


-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]