Re: [PATCH 03/10] t1450: make hash size independent

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

 



On 2019-06-11 at 23:20:31, Eric Sunshine wrote:
> On Tue, Jun 11, 2019 at 7:03 PM Jonathan Tan <jonathantanmy@xxxxxxxxxx> wrote:
> > >  test_expect_success 'alternate objects are correctly blamed' '
> > >       test_when_finished "rm -rf alt.git .git/objects/info/alternates" &&
> > > +     path=$(test_oid numeric) &&
> > > +     path=$(test_oid_to_path "$path") &&
> >
> > Double assignment to path?
> 
> I tripped over this, as well, when reading the patch, but if you look
> closely, the second assignment is "refining" a value computed in first
> assignment. It would have been clearer if written as:
> 
>     name=$(test_oid numeric) &&
>     path=$(test_oid_to_path "$name") &&
> 
> or:
> 
>     path=$(test_oid_to_path $(test_oid numeric))

I think in general people have discouraged the latter form because it
doesn't fail predictably if the inner command substitution fails. I'll
rename the first variable so that it's less surprising.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

Attachment: signature.asc
Description: PGP signature


[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