Re: Feature request: Reduce amount of diff in patch

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

 



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).


> @@ -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



[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