public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: COGONI Guillaume <cogoni.guillaume@gmail•com>
Cc: avarab@gmail•com, git.jonathan.bressat@gmail•com,
	git@vger•kernel.org, guillaume.cogoni@gmail•com,
	matthieu.moy@univ-lyon1•fr
Subject: Re: [PATCH v3 0/3] replace test [-f|-d] with more verbose functions
Date: Wed, 23 Feb 2022 14:59:09 -0800	[thread overview]
Message-ID: <xmqq35k9qjeq.fsf@gitster.g> (raw)
In-Reply-To: <20220222215430.605254-1-cogoni.guillaume@gmail.com> (COGONI Guillaume's message of "Tue, 22 Feb 2022 22:54:27 +0100")

COGONI Guillaume <cogoni.guillaume@gmail•com> writes:

> Make the code more readable in t/t3903-stash.sh and give more 
> friendly error message by replacing test [-f|-d] by the right 
> test_path_is_* functions.
> Add new functions like test_path_is_* to cover more specifics 
> cases like symbolic link or file that we explicitly refuse
> to be symbolic link.

All three look good to me.

Will queue.

As a possible #leftoverbits material, I suspect that we would
eventually want to be able to say

	test_path_is_file ! "$error_if_I_am_a_file"
	test_path_is_dir ! "$error_if_I_am_a_dir"
	test_path_is_symlink ! "$error_if_I_am_a_symlink"

so that we do not have to have the two ugly-looking special-case
combination "test_path_is_X_not_symlink" but just express what we
want with

	test_path_is_file "$path" && test_path_is_symlink ! "$path"

Once that happens, the two helpers introduced with 2/3 of this
series would become

	test_path_is_file_not_symlink () {
		test $# = 1 || BUG "1 param"
		test_path_is_file "$1" &&
		test_path_is_symlink ! "$1"
	}

But I do not want to see that as part of this series.  Let's
conclude this series and declare a success.

Thanks.




  parent reply	other threads:[~2022-02-23 22:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 13:46 [PATCH] t/t3903-stash.sh: replace test [-d|-f] with test_path_is_* COGONI Guillaume
2022-02-11 18:02 ` Junio C Hamano
2022-02-14 20:22   ` Cogoni Guillaume
2022-02-15 22:13     ` Ævar Arnfjörð Bjarmason
2022-02-18 17:10       ` [PATCH v2 0/2] replace test [-f|-d] with more verbose functions COGONI Guillaume
2022-02-18 17:12       ` COGONI Guillaume
2022-02-18 17:12         ` [PATCH v2 1/2] t/t3903-stash.sh: replace test [-d|-f] with test_path_is_* COGONI Guillaume
2022-02-18 17:12         ` [PATCH v2 2/2] Add new tests functions like test_path_is_* COGONI Guillaume
2022-02-18 18:48           ` Junio C Hamano
2022-02-22 21:54             ` [PATCH v3 0/3] replace test [-f|-d] with more verbose functions COGONI Guillaume
2022-02-22 21:54               ` [PATCH v3 1/3] t/t3903-stash.sh: replace test [-d|-f] with test_path_is_* COGONI Guillaume
2022-02-22 21:54               ` [PATCH v3 2/3] tests: allow testing if a path is truly a file or a directory COGONI Guillaume
2022-02-22 21:54               ` [PATCH v3 3/3] tests: make the code more readable COGONI Guillaume
2022-02-23 22:59               ` Junio C Hamano [this message]
2022-02-24 18:22                 ` [PATCH v3 0/3] replace test [-f|-d] with more verbose functions Cogoni Guillaume

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=xmqq35k9qjeq.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=avarab@gmail$(echo .)com \
    --cc=cogoni.guillaume@gmail$(echo .)com \
    --cc=git.jonathan.bressat@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=guillaume.cogoni@gmail$(echo .)com \
    --cc=matthieu.moy@univ-lyon1$(echo .)fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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