git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: Issam Maghni via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Issam Maghni <issam.e.maghni@mailbox.org>
Subject: Re: [PATCH] hook: test -a|o is not POSIX
Date: Sun, 09 Jan 2022 10:32:21 -0800	[thread overview]
Message-ID: <xmqqmtk43glm.fsf@gitster.g> (raw)
In-Reply-To: <9c7aeb5b-87b2-a51e-c08d-8dfc75ecf588@gmail.com> (Bagas Sanjaya's message of "Sun, 9 Jan 2022 15:14:11 +0700")

Bagas Sanjaya <bagasdotme@gmail.com> writes:

>> -		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
>
> From the patch above, the title should be "replace non-POSIX test -a & test -o with logical operator".

I think "should" is a bit too strong a word.  While yours is a bit
more explicit on _what_ the solution is, "hook: test -a|o is not
POSIX" already implies that we are fixing that non-posix-ness by
rewriting, and it is obvious (cf. Documentation/CodingGuidelines)
what the right rewrite should be.

One thing the original does a bit better tha yours is that it tell
us _where_ the problem is.  So, perhaps

    sample hook: use "test ... &&/|| test ..." instead of "test -a/-o"

But I find the original just fine.



      reply	other threads:[~2022-01-09 18:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07  4:03 [PATCH] hook: test -a|o is not POSIX Issam Maghni via GitGitGadget
2022-01-07 21:39 ` 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 [this message]

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=xmqqmtk43glm.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=bagasdotme@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --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 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 NNTP newsgroup(s).