From: Carlo Arenas <carenas@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, Jens.Lehmann@web.de
Subject: Re: [PATCH] test-lib-functions: avoid non POSIX ERE in test_dir_is_empty()
Date: Wed, 25 Aug 2021 23:28:40 -0700 [thread overview]
Message-ID: <CAPUEspjGkHhFNgTe3HnnUvkzwHfKqb9dYO3aCXDh_fRyFMRN6A@mail.gmail.com> (raw)
In-Reply-To: <YScXboC0M1IPNFon@nand.local>
On Wed, Aug 25, 2021 at 9:24 PM Taylor Blau <me@ttaylorr.com> wrote:
> On Wed, Aug 25, 2021 at 08:17:10PM -0700, Carlo Marcelo Arenas Belón wrote:
> > diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> > index e28411bb75..2803c97df3 100644
> > --- a/t/test-lib-functions.sh
> > +++ b/t/test-lib-functions.sh
> > @@ -790,7 +790,7 @@ test_path_exists () {
> > test_dir_is_empty () {
> > test "$#" -ne 1 && BUG "1 param"
> > test_path_is_dir "$1" &&
> > - if test -n "$(ls -a1 "$1" | egrep -v '^\.\.?$')"
> > + if test -n "$(ls -a1 "$1" | grep -v '^\.$' | grep -v '^\.\.$')"
>
> This replacement is correct, but I'm not sure that I necessarily find it
> simpler. If we really are concerned about egrep usage, then
>
> if test -n "$(find "$1" | grep -v '^\.$')"
Interesting idea; if having a much simpler expression is so important
then we could do instead [^.], since all use cases will be covered
(nobody is going to create a three dotted file to workaround a test
IMHO)
> But it looks like we are fairly OK with egrep in t (`git
> grep 'egrep' -- t | wc -l` turns up 19 matches), so I'm not sure the
> change is necessary in the first place.
egrep (and also fgrep, which we intentionally support because it is
missing from some ancient AIX system[1]) will be removed in the
next[2] release of GNU grep.
Carlo
[1] 87539416fd (tests: grep portability fixes, 2008-09-30)
[2] https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1
next prev parent reply other threads:[~2021-08-26 6:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 3:17 [PATCH] test-lib-functions: avoid non POSIX ERE in test_dir_is_empty() Carlo Marcelo Arenas Belón
2021-08-26 4:24 ` Taylor Blau
2021-08-26 6:25 ` Junio C Hamano
2021-08-26 7:48 ` Carlo Arenas
2021-08-26 6:28 ` Carlo Arenas [this message]
2021-08-26 19:21 ` Junio C Hamano
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=CAPUEspjGkHhFNgTe3HnnUvkzwHfKqb9dYO3aCXDh_fRyFMRN6A@mail.gmail.com \
--to=carenas@gmail.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.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).