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

2014-03-27 Thread Michael S. Tsirkin
Patch id changes if you reorder hunks in a diff. As the result is functionally equivalent, this is surprising to many people. In particular, reordering hunks is helpful to make patches more readable (e.g. API header diff before implementation diff). Change patch-id behaviour making it stable

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

2014-03-27 Thread Junio C Hamano
Michael S. Tsirkin m...@redhat.com 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

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

2014-03-27 Thread Michael S. Tsirkin
On Thu, Mar 27, 2014 at 09:58:41AM -0700, Junio C Hamano wrote: Michael S. Tsirkin m...@redhat.com 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

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

2014-03-27 Thread Michael S. Tsirkin
On Thu, Mar 27, 2014 at 09:58:41AM -0700, Junio C Hamano wrote: Michael S. Tsirkin m...@redhat.com 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

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

2014-03-27 Thread Junio C Hamano
Michael S. Tsirkin m...@redhat.com writes: 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: Yes, that is one of the things I

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

2014-03-27 Thread Michael S. Tsirkin
On Thu, Mar 27, 2014 at 11:03:46AM -0700, Junio C Hamano wrote: Michael S. Tsirkin m...@redhat.com writes: 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

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

2014-03-27 Thread Michael S. Tsirkin
On Thu, Mar 27, 2014 at 08:39:17PM +0200, Michael S. Tsirkin wrote: On Thu, Mar 27, 2014 at 11:03:46AM -0700, Junio C Hamano wrote: Michael S. Tsirkin m...@redhat.com writes: I started to remove that code, but then I recalled why I did it like this. There is a good reason. Yes, you