All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Issam Maghni via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Issam Maghni <issam.e.maghni@mailbox.org>,
	"Issam E. Maghni" <issam.e.maghni@mailbox.org>
Subject: [PATCH] hook: test -a|o is not POSIX
Date: Fri, 07 Jan 2022 04:03:41 +0000	[thread overview]
Message-ID: <pull.1172.git.git.1641528221530.gitgitgadget@gmail.com> (raw)

From: "Issam E. Maghni" <issam.e.maghni@mailbox.org>

I faced `test: too many arguments` when building using sbase [1]

This is due to a non-POSIX syntax `test ... -a ...` and `test … -o …`.

> The XSI extensions specifying the -a and -o binary primaries and the
> '(' and ')' operators have been marked obsolescent.
[2]

[1] https://core.suckless.org/sbase/
[2] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

Signed-off-by: Issam E. Maghni <issam.e.maghni@mailbox.org>
---
    shell: test -a|o is not POSIX
    
    I faced test: too many arguments when building using sbase
    [https://core.suckless.org/sbase/]. This is due to a non-POSIX syntax
    test ... -a ... and test … -o ….
    
    > The XSI extensions specifying the -a and -o binary primaries and the
    > '(' and ')' operators have been marked obsolescent.
    
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1172%2Fconcatime%2Fpatch-1-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1172/concatime/patch-1-v1
Pull-Request: https://github.com/git/git/pull/1172

 templates/hooks--update.sample | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/hooks--update.sample b/templates/hooks--update.sample
index c4d426bc6ee..6cc46ebcf3a 100755
--- a/templates/hooks--update.sample
+++ b/templates/hooks--update.sample
@@ -37,7 +37,7 @@ if [ -z "$GIT_DIR" ]; then
 	exit 1
 fi
 
-if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+if [ -z "$refname" ] || [ -z "$oldrev" ] || [ -z "$newrev" ]; then
 	echo "usage: $0 <ref> <oldrev> <newrev>" >&2
 	exit 1
 fi
@@ -95,7 +95,7 @@ case "$refname","$newrev_type" in
 		;;
 	refs/heads/*,commit)
 		# branch
-		if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
+		if [ "$oldrev" = "$zero" ] && [ "$denycreatebranch" = "true" ]; then
 			echo "*** Creating a branch is not allowed in this repository" >&2
 			exit 1
 		fi

base-commit: 2ae0a9cb8298185a94e5998086f380a355dd8907
-- 
gitgitgadget

             reply	other threads:[~2022-01-07  4:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07  4:03 Issam Maghni via GitGitGadget [this message]
2022-01-07 21:39 ` [PATCH] hook: test -a|o is not POSIX Junio C Hamano
2022-01-07 22:31   ` Issam E. Maghni
2022-01-09  8:14 ` Bagas Sanjaya
2022-01-09 18:32   ` 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

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

  git send-email \
    --in-reply-to=pull.1172.git.git.1641528221530.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=issam.e.maghni@mailbox.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.