threads / patch / 30890

patchgit-add--interactive.perl: Remove two unused variables

Subject: [PATCH] git-add--interactive.perl: Remove two unused variables

## tl;dr

7 messages between Jun 24, 2012 and Jun 25, 2012. Diffs are folded; open one to read it.

replies: 6people: 3as markdown or json

Thomas "Enki" Badie· Jun 24, 2012, 21:37 UTC · lore

The patch 8f0bef6 refactors this script and leaves the `$fh' variable unused in `diff_applies' and `patch_update_file'.

Signed-off-by: Thomas Badie <badie@lrde.epita.fr>
---
Hello,
This is my first patch. It introduces a really minor change, and I
also want to be sure the way I submit it is the right way. Thanks :)
  git-add--interactive.perl |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
Show changes to git-add--interactive.perl +0 −2
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index d948aa8..710764a 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1067,7 +1067,6 @@ EOF
  }

  sub diff_applies {
-       my $fh;
        return run_git_apply($patch_mode_flavour{APPLY_CHECK} . '--check',
                             map { @{$_->{TEXT}} } @_);
  }
@@ -1514,7 +1513,6 @@ sub patch_update_file {
        }

        if (@result) {
-               my $fh;
                my @patch = reassemble_patch($head->{TEXT}, @result);
                my $apply_routine = $patch_mode_flavour{APPLY};
                &$apply_routine(@patch);
-- 
1.7.5.4
Junio C Hamano· Jun 25, 2012, 05:41 UTC · re: Thomas "Enki" Badie · lore

Re: [PATCH] git-add--interactive.perl: Remove two unused variables

"Thomas \"Enki\" Badie" <thomas.badie@gmail.com> writes:
Show 8 quoted lines
> The patch 8f0bef6 refactors this script and leaves the `$fh' variable
> unused in `diff_applies' and `patch_update_file'.
>
> Signed-off-by: Thomas Badie <badie@lrde.epita.fr>
> ---
> Hello,
> This is my first patch. It introduces a really minor change, and I
> also want to be sure the way I submit it is the right way. Thanks :)
The patch submission is almost perfect, except that:
 (1) the patch seems to be whitespace damaged; and
 (2) the author of the problematic commit should have been Cc'ed
     (especially when he is still an active participant on the list)
     to give him a chance to Ack it (I'm adding Thomas for this).

Thanks. I like that you identified why this is a good thing by quoting the problematic change.

Show 23 quoted lines
>  git-add--interactive.perl |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index d948aa8..710764a 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -1067,7 +1067,6 @@ EOF
>  }
>
>  sub diff_applies {
> -       my $fh;
>        return run_git_apply($patch_mode_flavour{APPLY_CHECK} . '--check',
>                             map { @{$_->{TEXT}} } @_);
>  }
> @@ -1514,7 +1513,6 @@ sub patch_update_file {
>        }
>
>        if (@result) {
> -               my $fh;
>                my @patch = reassemble_patch($head->{TEXT}, @result);
>                my $apply_routine = $patch_mode_flavour{APPLY};
>                &$apply_routine(@patch);
Thomas Rast· Jun 25, 2012, 09:12 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-add--interactive.perl: Remove two unused variables

Junio C Hamano <gitster@pobox.com> writes:
> "Thomas \"Enki\" Badie" <thomas.badie@gmail.com> writes:
>
>> The patch 8f0bef6 refactors this script and leaves the `$fh' variable
>> unused in `diff_applies' and `patch_update_file'.
[...]
>  (2) the author of the problematic commit should have been Cc'ed
>      (especially when he is still an active participant on the list)
>      to give him a chance to Ack it (I'm adding Thomas for this).

Indeed, my bad. It's easy to verify from 'git show 8f0bef6' that this was an oversight in my patch.

Acked-by: Thomas Rast <trast@student.ethz.ch>
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Thomas Badie· Jun 25, 2012, 10:16 UTC · re: Thomas Rast · lore

Re: [PATCH] git-add--interactive.perl: Remove two unused variables

2012/6/25 Thomas Rast <trast@inf.ethz.ch>:
Show 15 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> "Thomas \"Enki\" Badie" <thomas.badie@gmail.com> writes:
>>
>>> The patch 8f0bef6 refactors this script and leaves the `$fh' variable
>>> unused in `diff_applies' and `patch_update_file'.
> [...]
>>  (2) the author of the problematic commit should have been Cc'ed
>>      (especially when he is still an active participant on the list)
>>      to give him a chance to Ack it (I'm adding Thomas for this).
>
> Indeed, my bad.  It's easy to verify from 'git show 8f0bef6' that this
> was an oversight in my patch.
>
> Acked-by: Thomas Rast <trast@student.ethz.ch>
It happens to everyone^^ Thanks for your answer.

Should I repost a patch V2 or it is okay like this? Thanks

-- 
Thomas "Enki" Badie
Thomas Badie· Jun 25, 2012, 10:12 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-add--interactive.perl: Remove two unused variables

2012/6/25 Junio C Hamano <gitster@pobox.com>:
Show 15 quoted lines
> "Thomas \"Enki\" Badie" <thomas.badie@gmail.com> writes:
>
>> The patch 8f0bef6 refactors this script and leaves the `$fh' variable
>> unused in `diff_applies' and `patch_update_file'.
>>
>> Signed-off-by: Thomas Badie <badie@lrde.epita.fr>
>> ---
>> Hello,
>> This is my first patch. It introduces a really minor change, and I
>> also want to be sure the way I submit it is the right way. Thanks :)
>
> The patch submission is almost perfect, except that:
>
>  (1) the patch seems to be whitespace damaged; and
>

The only damage I see is a space on the deleted lines which doesn't exist in the patch. Is that you're talking about ? I need to investigate why it appears...

>  (2) the author of the problematic commit should have been Cc'ed
>     (especially when he is still an active participant on the list)
>     to give him a chance to Ack it (I'm adding Thomas for this).

My bad, I forgot to check if the commiter were still active. I'll check it for the next time.

> Thanks.  I like that you identified why this is a good thing by
> quoting the problematic change.
Thanks :)
Show 23 quoted lines
>>  git-add--interactive.perl |    2 --
>>  1 files changed, 0 insertions(+), 2 deletions(-)
>>
>> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
>> index d948aa8..710764a 100755
>> --- a/git-add--interactive.perl
>> +++ b/git-add--interactive.perl
>> @@ -1067,7 +1067,6 @@ EOF
>>  }
>>
>>  sub diff_applies {
>> -      my $fh;
>>        return run_git_apply($patch_mode_flavour{APPLY_CHECK} . '--check',
>>                             map { @{$_->{TEXT}} } @_);
>>  }
>> @@ -1514,7 +1513,6 @@ sub patch_update_file {
>>        }
>>
>>        if (@result) {
>> -              my $fh;
>>                my @patch = reassemble_patch($head->{TEXT}, @result);
>>                my $apply_routine = $patch_mode_flavour{APPLY};
>>                &$apply_routine(@patch);
-- 
Thomas "Enki" Badie
Junio C Hamano· Jun 25, 2012, 18:06 UTC · re: Thomas Badie · lore

Re: [PATCH] git-add--interactive.perl: Remove two unused variables

Thomas Badie <thomas.badie@gmail.com> writes:
Show 20 quoted lines
> 2012/6/25 Junio C Hamano <gitster@pobox.com>:
>> "Thomas \"Enki\" Badie" <thomas.badie@gmail.com> writes:
>>
>>> The patch 8f0bef6 refactors this script and leaves the `$fh' variable
>>> unused in `diff_applies' and `patch_update_file'.
>>>
>>> Signed-off-by: Thomas Badie <badie@lrde.epita.fr>
>>> ---
>>> Hello,
>>> This is my first patch. It introduces a really minor change, and I
>>> also want to be sure the way I submit it is the right way. Thanks :)
>>
>> The patch submission is almost perfect, except that:
>>
>> (1) the patch seems to be whitespace damaged; and
>>
>
> The only damage I see is a space on the deleted lines which doesn't
> exist in the patch. Is that you're talking about ?
> I need to investigate why it appears...

A typical context line would begin with SP and typically then tab (because our code is indented with leading tabs) but your context lines all have two SPs in front and indented with more SPs. This is a symptom of your MUA mangling your patch, and the reason can be seen in the "Content-Type: text/plain; charset=ISO-8859-1; format=flowed" header.

Thomas Badie· Jun 25, 2012, 22:41 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-add--interactive.perl: Remove two unused variables

On 25/06/2012 20:06, Junio C Hamano wrote:
Show 30 quoted lines
> Thomas Badie <thomas.badie@gmail.com> writes:
> 
>> 2012/6/25 Junio C Hamano <gitster@pobox.com>:
>>> "Thomas \"Enki\" Badie" <thomas.badie@gmail.com> writes:
>>>
>>>> The patch 8f0bef6 refactors this script and leaves the `$fh' variable
>>>> unused in `diff_applies' and `patch_update_file'.
>>>>
>>>> Signed-off-by: Thomas Badie <badie@lrde.epita.fr>
>>>> ---
>>>> Hello,
>>>> This is my first patch. It introduces a really minor change, and I
>>>> also want to be sure the way I submit it is the right way. Thanks :)
>>>
>>> The patch submission is almost perfect, except that:
>>>
>>> (1) the patch seems to be whitespace damaged; and
>>>
>>
>> The only damage I see is a space on the deleted lines which doesn't
>> exist in the patch. Is that you're talking about ?
>> I need to investigate why it appears...
> 
> A typical context line would begin with SP and typically then tab
> (because our code is indented with leading tabs) but your context
> lines all have two SPs in front and indented with more SPs.  This is
> a symptom of your MUA mangling your patch, and the reason can be seen
> in the "Content-Type: text/plain; charset=ISO-8859-1; format=flowed"
> header.
> 

I follow the first approach in the tutorial in `git format-patch --help`, and I hope it works as expected :)

I wonder what is the next step, should I repost the previous patch with the line "Acked-by: Thomas Rast <trast@student.ethz.ch>" or it is okay right now?

Thanks a lot for your help on this first patch,
-- 
Thomas "Enki" Badie

← back to recent threads