git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] test-lib-functions: avoid non POSIX ERE in test_dir_is_empty()
@ 2021-08-26  3:17 Carlo Marcelo Arenas Belón
  2021-08-26  4:24 ` Taylor Blau
  0 siblings, 1 reply; 6+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2021-08-26  3:17 UTC (permalink / raw)
  To: git; +Cc: Jens.Lehmann, Carlo Marcelo Arenas Belón

0be7d9b73d (test-lib: add test_dir_is_empty(), 2014-06-19) uses an
ERE through the egrep tool (which is not POSIX) using an ? operator
that isn't either.

replace invocation with two equivalent simpler BRE instead.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 '^\.\.$')"
 	then
 		echo "Directory '$1' is not empty, it contains:"
 		ls -la "$1"
-- 
2.33.0.481.g26d3bed244


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-26 19:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-08-26 19:21     ` Junio C Hamano

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).