Thread (1 message) 1 message, 1 author, 2020-09-20

Re: [PATCH 2/4] builtin/rev-parse: learn --null-oid

From: Andreas Schwab <hidden>
Date: 2020-09-20 16:03:29

On Sep 18 2020, brian m. carlson wrote:
What I typically do when I write shell scripts, and which may obviate
the need for this patch is turn this:

  [ "$oid" = 0000000000000000000000000000000000000000 ]

into this:

  echo "$oid" | grep -qsE '^0+$'

This is slightly less efficient, but it's also backwards compatible
with older Git version assuming you have a POSIX grep.
You can also use

  case $oid in *[1-9a-f]*) ... ;; *) ... ;; esac

which doesn't need an external process.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help