Git development
 help / color / mirror / Atom feed
From: Ben Knoble <ben.knoble@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andrew Pleeter via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Jeff King <peff@peff.net>,
	Andrew Pleeter <andrewpleeter@gmail.com>
Subject: Re: [PATCH v3] var: support broken-down idents, default key, multiple args, and -z
Date: Thu, 3 Sep 2026 14:22:46 -0400	[thread overview]
Message-ID: <D27B3BE0-56E7-4388-9324-C16E2AAE2498@gmail.com> (raw)
In-Reply-To: <xmqqbjaecjxb.fsf@gitster.g>


> Le 3 sept. 2026 à 14:02, Junio C Hamano <gitster@pobox.com> a écrit :
> 
> "Andrew Pleeter via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> +    if (!vars.nr)
>>        usage(var_usage);
> 
> I do not know if this is friendly for a tool meant primarily for
> scripts.  "git var foo bar" would give information about foo and
> bar, "git var foo" would give informmation about foo, and it is
> natural "git var" alone would give nothing.

I believe « git var » prints usage and exits 129 today, at least on my 2.55.0.340.g8e2bf96aa5.

Lifting the limitation may be sensible, though I suspect the empty case is likely to indicate a logic error earlier in the script; either way, probably out of scope here for now?

> This matters because it is plausible to have a list of vars in a
> variable and then run "git var -z $variables | xargs -0 ..." to
> process the vars and their values.  If you barf for an empty list,
> then they need to see if they have nothing in $variable, which
> becomes more than "test -z "$variable" because people often take
> advantage of the fact that IFS is ignored to write their accumulator
> like so
> 
>    variable=" "
>    for n in ...
>    do
>        variable="$variable$n "
>    done
> 
>    case "$variable" in
>    *" "word" "*)
>        : has the word
>        ;;
>    esac
> 
> which means that $variable may not be an empty string.  It is easier
> for scripts if "git var <variable>..." did not barf when the number
> of <variable>s happens to be zero.

  reply	other threads:[~2026-09-03 18:22 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 [this message]
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
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=D27B3BE0-56E7-4388-9324-C16E2AAE2498@gmail.com \
    --to=ben.knoble@gmail.com \
    --cc=andrewpleeter@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox