git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Sven van Haastregt <svenvh@gmail.com>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2] git-submodule.sh: shorten submodule SHA-1s using rev-parse
Date: Sun, 27 Jan 2019 18:33:36 -0800	[thread overview]
Message-ID: <xmqqy375bjen.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <CAPig+cRLLTYB=tVOY39dojLYZqoX=yxPRZY9fjo9z+5+P2BKKg@mail.gmail.com> (Eric Sunshine's message of "Sun, 27 Jan 2019 18:46:10 -0500")

Eric Sunshine <sunshine@sunshineco.com> 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 ;-).

      reply	other threads:[~2019-01-28  2:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-27 19:27 [PATCH v2] git-submodule.sh: shorten submodule SHA-1s using rev-parse Sven van Haastregt
2019-01-27 23:46 ` Eric Sunshine
2019-01-28  2:33   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy375bjen.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.com \
    --cc=svenvh@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).