Re: Feature request: Reduce amount of diff in patch
From: Kaartic Sivaraam <hidden>
Date: 2017-11-28 17:24:55
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Tue, 2017-11-28 at 18:09 +0200, KES wrote:
Hi. I get often patches which can be minimized:
I guess the one below can't be (see below).
quoted hunk ↗ jump to hunk
@@ -60,11 +64,8 @@ sub _get_filter { address => { -like => \[ '?', "%$search%" ] }, company => { -like => \[ '?', "%$search%" ] }, country_code => { '=' => \[ 'UPPER(?)' => $search ] }, - ]); - $users = $users->search( $filter, { - prefetch => { Packages => { Ips => { Subnet => { Server => 'Locality' }}}}, - }); + ]); return $users;This patch can be minimized to:@@ -60,11 +64,8 @@ sub _get_filter { address => { -like => \[ '?', "%$search%" ] }, company => { -like => \[ '?', "%$search%" ] }, country_code => { '=' => \[ 'UPPER(?)' => $search ] }, ]); - $users = $users->search( $filter, { - prefetch => { Packages => { Ips => { Subnet => { Server => 'Locality' }}}}, - }); return $users;May you please fix the git to generate minimized patches?
You seemed to have overlooked the empty line above the ']);' in the original patch. So, your minimized version isn't actually equivalent to the original one. Further, when trying to recreate your patch I get the following,
diff --git a/diff-test b/diff-test
index 1d5dc1b..f3ec38f 100644
--- a/diff-test
+++ b/diff-test@@ -1,10 +1,8 @@ address => { -like => \[ '?', "%$search%" ] }, company => { -like => \[ '?', "%$search%" ] }, country_code => { '=' => \[ 'UPPER(?)' => $search ] }, + ]); - $users = $users->search( $filter, { - prefetch => { Packages => { Ips => { Subnet => { Server => 'Locality' }}}}, - }); return $users;
I use git built from the source (2.15.0.531.g2ccb3012c) -- Kaartic