From: Junio C Hamano Date: Mon, 28 Jan 2019 02:33:36 GMT Subject: Re: [PATCH v2] git-submodule.sh: shorten submodule SHA-1s using rev-parse Message-ID: In-Reply-To: Eric Sunshine 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 ;-).