Re: [PATCH v4] branch: support for shortcuts like @{-1}, completed

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

 



On 8/10/22 9:23, Eric Sunshine wrote:
> On Sat, Oct 8, 2022 at 3:07 AM Rubén Justo <rjusto@xxxxxxxxx> wrote:
>> On 8/10/22 5:17, Eric Sunshine wrote:
>>> On Fri, Oct 7, 2022 at 9:36 PM Rubén Justo <rjusto@xxxxxxxxx> wrote:
>>>> +       echo "Branch description\n" >expect &&
>>>
>>> Is the intention here with the embedded "\n" that `echo` should emit
>>> two newlines? If so, interpreting "\n" specially is not POSIX behavior
>>> for `echo`, thus we probably don't want to rely upon it.
>>
>> Oops. Thank you! I'll reroll back to using "git stripspace".
> 
> `git stripspace` is perhaps unnecessarily heavyweight. Lightweight
> alternatives would include:
> 
>     printf "Branch description\n\n" >expect &&
> 
>     test_write_lines "Branch description" "" >expect &&
> 
>     { echo "Branch description" && echo; } >expect &&
> 
>     cat >expect <<-\EOF &&
>     Branch description
> 
>     EOF
> 

Yeah, I thought about that.  What convinced me to use "git stripspace" was
that maybe that '\n' tail could be removed sometime from the description
setting and this will be fine with that.  I haven't found any reason for
that '\n' and it bugs me a little seeing it in the config :-)

But I agree with you about the unnecessarily heavyweight, though all
involves a new process, probably echo, cat or printf are lightweight than
another instance of git for that.

All of this involves two files and that is how it is done almost everywhere
except in some places where it looks like an 'older way' (test_i18ngrep) of
doing it.  Is there any reason to do it this way and not using variables,
process substitution,..?

Anyway I'll switch to one of your suggestions, as it is definitely easier
to read, understand and therefore change if needed.

Thanks!



[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