Problem with mutt version.sh script

Kevin J. McCarthy kevin at 8t8.us
Mon Apr 16 16:26:51 UTC 2018


On Mon, Apr 16, 2018 at 10:18:57AM -0400, Aaron Schrab wrote:
> At 15:41 +0200 16 Apr 2018, Gero Treuner <gero-mutt at innocircle.com> wrote:
> > On Mon, Apr 16, 2018 at 07:53:56AM -0500, Paul Keusemann wrote:
> > > { [ -e ".git" ] && command -v git >/dev/null 2>&1; } \
> > > || exec cat VERSION
> > > 
> > > does not work when run in a bourne shell.  The -e option is not supported in
> 
> > I'd prefer using an option which is supported by Bourne shell. What
> > about "-d"?
> 
> The `.git` entry won't always be a directory. There are a few ways that it
> could be a file instead (`git clone --separate-git-dir` and `git worktree
> add` are a couple ways).
> 
> I believe that `-r` is supported by the Bourne shell as well, and should
> handle `.git` being either a file or a directory.

Whoops, thank you Paul for pointing this out.

Originally, the test was '-d', but as Aaron notes, .git can be a file
too.  I thought having dash as /bin/sh would catch these issues but
somehow the '-e' problem slipped past us.

Aaron, your suggestion of '-r' looks like a good idea.  Does anyone know
of a problem with that?  Otherwise I'll swap that out in version.sh and
mkreldate.sh.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-dev/attachments/20180416/ae9df09e/attachment.asc>


More information about the Mutt-dev mailing list