From: Phillip Wood <phillip.wood123@gmail.com>
To: Andrew Pleeter <andrewpleeter@gmail.com>, git@vger.kernel.org
Cc: gitster@pobox.com, phillip.wood@dunelm.org.uk,
ben.knoble@gmail.com, peff@peff.net,
sandals@crustytoothpaste.net
Subject: Re: [PATCH v9 3/4] var: accept more than one variable
Date: Fri, 2 Oct 2026 15:11:38 +0100 [thread overview]
Message-ID: <cda2dd01-9dab-4842-86af-9b77767dfc52@gmail.com> (raw)
In-Reply-To: <20260926162048.30853-4-andrewpleeter@gmail.com>
Hi Andrew
This all looks fine, though we typically avoid using test_env() because
it introduces a hidden subshell. I've left a couple of suggestions
below, but unless there is another reason to re-roll I wouldn't worry
too much.
On 26/09/2026 17:20, Andrew Pleeter wrote:
> +test_expect_success 'variable without a value is omitted but is not an error' '
> + test_tick &&
> + cat >expect <<-EOF &&
> + GIT_AUTHOR_IDENT=$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE
> + GIT_COMMITTER_IDENT=$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
> + EOF
> + test_env GIT_CONFIG_GLOBAL= \
> + git var GIT_AUTHOR_IDENT GIT_CONFIG_GLOBAL GIT_COMMITTER_IDENT >actual &&
There is no need to use test_env here, "GIT_CONFIG_GLOBAL= git var ..."
is all that's needed.
> + test_cmp expect actual
> +'
> +
> +test_expect_success 'a single variable without a value still exits with 1' '
> + test_env GIT_CONFIG_GLOBAL= test_expect_code 1 git var GIT_CONFIG_GLOBAL >out &&
Here test_env is also not needed, "env GIT_CONFIG_GLOBAL=
test_expect_code 1 git var ..." would be our typical style.
Thanks
Phillip
> + test_must_be_empty out
> +'
> +
> +test_expect_success 'unknown variable is a usage error' '
> + test_must_fail git var GIT_AUTHOR_IDENT NO_SUCH_VARIABLE 2>err &&
> + test_grep usage err
> +'
> +
> test_done
next prev parent reply other threads:[~2026-10-02 14:11 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 20:46 [PATCH] builtin/whoami: add new 'whoami' command Andrew Pleeter via GitGitGadget
2026-08-25 21:24 ` brian m. carlson
2026-08-25 21:41 ` Junio C Hamano
2026-08-31 23:59 ` [PATCH v2] builtin/ident: add new 'ident' command Andrew Pleeter via GitGitGadget
2026-09-01 4:39 ` Jeff King
2026-09-01 5:00 ` Junio C Hamano
2026-09-03 2:49 ` [PATCH v3] var: support broken-down idents, default key, multiple args, and -z Andrew Pleeter via GitGitGadget
2026-09-03 17:40 ` Junio C Hamano
2026-09-03 18:22 ` Ben Knoble
2026-09-04 9:11 ` Phillip Wood
2026-09-04 15:57 ` Junio C Hamano
2026-09-08 9:07 ` Phillip Wood
2026-09-08 4:09 ` [PATCH v4] var: support broken-down idents, signing " Andrew Pleeter via GitGitGadget
2026-09-08 13:54 ` Phillip Wood
2026-09-08 20:43 ` [PATCH v5] " Andrew Pleeter via GitGitGadget
2026-09-08 21:53 ` Junio C Hamano
2026-09-09 1:24 ` [PATCH v6] " Andrew Pleeter via GitGitGadget
2026-09-09 15:36 ` Phillip Wood
2026-09-09 16:42 ` Junio C Hamano
2026-09-10 3:09 ` [PATCH v7] " Andrew Pleeter via GitGitGadget
2026-09-14 19:34 ` Junio C Hamano
2026-09-14 22:50 ` [PATCH v8] " Andrew Pleeter via GitGitGadget
2026-09-15 17:21 ` Junio C Hamano
2026-09-15 22:02 ` Andrew Pleeter
2026-09-22 14:57 ` Phillip Wood
2026-09-26 16:19 ` Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 0/4] var: -z output, multiple variables, and broken-out idents Andrew Pleeter
2026-10-02 14:11 ` Phillip Wood
2026-10-02 17:41 ` Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 1/4] var: represent multi-valued variables with a string_list Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 2/4] var: add "-z" output mode Andrew Pleeter
2026-09-26 16:20 ` [PATCH v9 3/4] var: accept more than one variable Andrew Pleeter
2026-10-02 14:11 ` Phillip Wood [this message]
2026-09-26 16:20 ` [PATCH v9 4/4] var: add broken-out identity variables Andrew Pleeter
2026-10-02 14:11 ` Phillip Wood
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=cda2dd01-9dab-4842-86af-9b77767dfc52@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=andrewpleeter@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--cc=sandals@crustytoothpaste.net \
/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.