Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Vsevolod Myalitsin <ub4nal@mail.ru>,
	git@vger.kernel.org, ben.knoble@gmail.org, gitster@pobox.me
Subject: Re: [PATCH v4 2/3] advice: introduce advice scoping mechanism
Date: Thu, 10 Sep 2026 15:03:45 -0400	[thread overview]
Message-ID: <20260910190345.GA903701@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqpkyldke1.fsf@gitster.g>

On Thu, Sep 10, 2026 at 11:35:50AM -0700, Junio C Hamano wrote:

> The primary reason why I didn't think of "--worktree" is because
> output of "git config --help" has room for improvements.  This is a
> tangent, but one of its SYNOPSIS item reads like this:
> 
> 	git config set [<file-option>] [--type=<type>] [--all] \
> 		[--value=<pattern>] [--fixed-value] <name> <value>

If it makes you feel any better, I did not even know --worktree existed
until today. ;) I only discovered it when looking at the possible values
returned by config_scope_name().

I still have trouble imagining why a particular piece of advice would
make sense only in --worktree mode. The only concrete case I've seen for
any advice scoping is that clone/init advice config does not make sense
in repo config. And --global is the sensible solution to that (--system
works, too, but it is not a very helpful recommendation).

I kind of wonder if _all_ advice should just say "--global". I cannot
think of an advice flag that is really repo specific. They are about
silencing extra help because the _user_ understands the situation and
wants Git to be less chatty.

> --- >8 ---
> Subject: [PATCH] doc: clarify <file-option> in "git config --help"
> 
> The SYNOPSIS section of "git config --help" refers to <file-option>
> without explaining what they really mean.
> 
> I *think* they meant to refer to the mechanism to limit the file(s)
> read from or written to by giving the scope options or the '--file
> <filename>' option.  Spell it out early in the description.

I agree that we should use the term <file-option> to refer to it. I
think the paragraphs just below what you touched try to explain these,
but don't use the term.

Something like the patch below uses the term. There's also a lot of
duplication between the reading/writing paragraphs that could be
condensed (but I didn't do it here).

diff --git a/Documentation/git-config.adoc b/Documentation/git-config.adoc
index 8d080e301b..18cee89f84 100644
--- a/Documentation/git-config.adoc
+++ b/Documentation/git-config.adoc
@@ -40,16 +40,14 @@ outgoing values are canonicalize-able under the given <type>.  If no
 unset an existing `--type` specifier with `--no-type`.
 
 When reading, the values are read from the system, global and
-repository local configuration files by default, and options
-`--system`, `--global`, `--local`, `--worktree` and
-`--file <filename>` can be used to tell the command to read from only
+repository local configuration files by default. Provide a
+`<file-option>` (`--system`, `--global`, `--local`, `--worktree`,
+or `--file <filename>`) to tell the command to read from only
 that location (see <<FILES>>).
 
 When writing, the new value is written to the repository local
-configuration file by default, and options `--system`, `--global`,
-`--worktree`, `--file <filename>` can be used to tell the command to
-write to that location (you can say `--local` but that is the
-default).
+configuration file by default. A `<file-options>` can be used to tell
+the command to write to that location.
 
 This command will fail with non-zero status upon error.  Some exit
 codes are:


I also considered that the options themselves should be grouped as
sub-entries of a <file-options>:: entry, but I think that may create
other awkwardness.

There is also --blob, which affects the source/dest of config, but isn't
really a "file" option. It is really more of a "location" option (and
that is what it is called in the macro grouping within the code, though
that is never exposed to the user).

>  * The SYNOPSIS section also refers to <display-option> for many
>    operations; I have no idea what it means.  I left a needswork
>    comment there.  We should either clarify it in a similar way, or
>    remove it if it does not refer to anything.

It comes from 14970509c6 (builtin/config: introduce "list" subcommand,
2024-05-06), and there's similar macro magic. It really just means
"stuff that changes the list output".

I think the manpage could probably be rewritten to focus on the
different command modes, and have a section for "here are the useful
options in list mode". Whereas historically, "--list" was just another
option. That would be a much bigger rewrite of the page, though.

-Peff

  reply	other threads:[~2026-09-10 19:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2027-08-29  0:49 [PATCH v3] advice: use global config for default branch name Vsevolod Myalitsin
2026-09-09 20:27 ` Jeff King
2026-09-09 21:21   ` Junio C Hamano
2026-09-09 21:22   ` Vsevolod Myalitsin
2026-09-09 22:46     ` Jeff King
2026-09-10  4:43       ` Vsevolod Myalitsin
2026-09-09 20:50 ` Junio C Hamano
2026-09-09 21:30   ` Vsevolod Myalitsin
2026-09-09 22:31     ` Junio C Hamano
2026-09-10  8:53 ` [PATCH v4 0/3] defaultBranchName advice is useless Vsevolod Myalitsin
2026-09-10  8:53   ` [PATCH v4 1/3] advice: pass the entire advice_setting to vadvise() Vsevolod Myalitsin
2026-09-10 17:43     ` SZEDER Gábor
2026-09-10  8:53   ` [PATCH v4 2/3] advice: introduce advice scoping mechanism Vsevolod Myalitsin
2026-09-10 15:36     ` Junio C Hamano
2026-09-10 15:52       ` Jeff King
2026-09-10 17:54         ` Vsevolod Myalitsin
2026-09-10 19:05           ` Jeff King
2026-09-10 18:35         ` Junio C Hamano
2026-09-10 19:03           ` Jeff King [this message]
2026-09-10 19:54             ` Junio C Hamano
2026-09-10 20:11               ` Jeff King
2026-09-10 20:25                 ` Junio C Hamano
2026-09-12  8:12                   ` Vsevolod Myalitsin
2026-09-13 16:32                     ` Junio C Hamano
2026-09-10  8:53   ` [PATCH v4 3/3] advice: use global config for default branch name Vsevolod Myalitsin

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=20260910190345.GA903701@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=ben.knoble@gmail.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gitster@pobox.me \
    --cc=ub4nal@mail.ru \
    /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