Re: [PATCH 4/8] rebase: prepare to do generic housekeeping

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

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> On Fri, May 10, 2013 at 10:26 AM, Ramkumar Ramachandra
> <artagnon@xxxxxxxxx> wrote:
>> On successful completion of a rebase in git-rebase--$backend.sh, the
>> $backend script cleans up on its own and exits.  The cleanup routine
>> is however, independent of the $backend, and each $backend script
>> unnecessarily duplicates this work:
>>
>>     rm -rf "$state_dir"
>>     git gc --auto
>>
>> Prepare git-rebase.sh for later patches that return control from each
>> $backend script back to us, for performing this generic cleanup
>> routine.
>>
>> Another advantage is that git-rebase.sh can implement a generic
>> finish_rebase() to possibly do additional tasks in addition to the
>> cleanup.
>>
>> Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx>
>> ---
>>  git-rebase.sh | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/git-rebase.sh b/git-rebase.sh
>> index 2c692c3..84dc7b0 100755
>> --- a/git-rebase.sh
>> +++ b/git-rebase.sh
>> @@ -150,6 +150,13 @@ run_specific_rebase () {
>>                 autosquash=
>>         fi
>>         . git-rebase--$type
>> +       ret=$?
>> +       if test $ret = 0
>
> For numeric comparison, use '-eq' rather than '=', which is for strings.

Do not listen to this.

We know the condition we want is to have $?  with a value that
stringifies to "0" and the above reads much easier.

>
>> +       then
>> +               git gc --auto &&
>> +               rm -rf "$state_dir"
>> +       fi
>> +       exit $ret
>>  }
>>
>>  run_pre_rebase_hook () {
--
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]