Re: [PATCH v2] git-submodule.sh: shorten submodule SHA-1s using rev-parse

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

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> This could be made a bit easier to follow by using indentation and ||
> rather than &&. For instance, rewriting the entire block as:
>
>     # Shorten with hard-coded fallback if rev-parse fails
>     sha1_abbr_src=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_src ||
>         echo $sha1_src | cut -c1-7)
>     sha1_abbr_dst=$(GIT_DIR="$name/.git" git rev-parse --short $sha1_dst ||
>         echo $sha1_dst | cut -c1-7)
>
> In fact, the code is clear enough that the comment isn't even needed.
>
> By the way, if git-rev-parse does fail, is it going to produce an
> error message on stderr that needs to be suppressed?

All good points ;-).



[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