public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "VALERI Yoann via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Patrick Steinhardt <ps@pks.im>,
	 Yoann Valeri <yoann.valeri@cea.fr>
Subject: Re: [PATCH v2 2/2] branch: add a no-prefix option
Date: Fri, 27 Feb 2026 09:07:45 -0800	[thread overview]
Message-ID: <xmqqtsv2ru72.fsf@gitster.g> (raw)
In-Reply-To: <0fbdf031cb9f054e023d44fd3eb3315732d527c0.1772207333.git.gitgitgadget@gmail.com> (VALERI Yoann via GitGitGadget's message of "Fri, 27 Feb 2026 15:48:53 +0000")

"VALERI Yoann via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: VALERI Yoann <yoann.valeri@cea.fr>
>
> This patch adds a '--no-prefix' option to 'git branch' to selectively
> override the 'branch.addCurrentBranchAsPrefix' configuration parameter.
> Signed-off-by: VALERI Yoann <yoann.valeri@cea.fr>
> ---

That is unusual in multiple ways.

The usual way to do so is to give a command line option that is
usable without needing any configuration.  This happens first in
early patches in a series.

And then, assuming that the command line option is widely supported
as useful (but cumbersome to specify every time), help the users by
adding a configuration variable, that can be overridden via the
command line option.  That happens next in later patches in a
series.

And in order to help users discover these two features more easily,
it is customery to give them very similar names.  In other words,
adding "--[no-]prefix-current-branch-name" may be more
understandable if it is added in patch [1/2], if we want to make the
matching configuration "branch.addCurrentBranchAsPrefix" in patch
[2/2].

Even better, have you considered leaving the door open for _others_
to come up with better ideas _later_ by making it extensible, e.g.,

    --no-name-prefix
    --name-prefix=<token>

where the initial implementation the only supported <token> is
"current" (to signal "current branch name")?  That would mean that
the corresponding configuration variable would also be a string, not
a boolean, e.g., "branch.namePrefix = current".

Perhaps those who work with more than one remotes want to give their
branches meant to be pushed to remote A with prefix A- while naming
the branches meant to be pushed to remote B with prefix B-, or
something, that is not based on the current branch but something
else (e.g., @{push} in this hypothetical example).  I am not saying
that you should add such a support to the feature in this series
(quite honestly, I am not convinced at all if prefixing with the
current branch name is even something worth adding myself), but we
do not want to end up with millions of branch.add${Foo}AsPrefix with
different values of ${Foo} when we discover that such prefixing
scheme is useful in the future.

Thanks.


  reply	other threads:[~2026-02-27 17:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20  8:07 [PATCH] branch: add 'branch.addCurrentBranchAsPrefix' config param Yoann Valeri via GitGitGadget
2026-02-20 15:59 ` Junio C Hamano
2026-02-20 16:08 ` Junio C Hamano
2026-02-27 15:48 ` [PATCH v2 0/2] " Yoann Valeri via GitGitGadget
2026-02-27 15:48   ` [PATCH v2 1/2] " VALERI Yoann via GitGitGadget
2026-02-27 15:48   ` [PATCH v2 2/2] branch: add a no-prefix option VALERI Yoann via GitGitGadget
2026-02-27 17:07     ` Junio C Hamano [this message]
2026-03-06 13:14   ` [PATCH v3 0/3] branch: add prefixes to new branch names Yoann Valeri via GitGitGadget
2026-03-06 13:14     ` [PATCH v3 1/3] branch: add '--name-prefix' option VALERI Yoann via GitGitGadget
2026-03-07  7:06       ` Eric Sunshine
2026-03-08  7:06       ` Junio C Hamano
2026-03-06 13:14     ` [PATCH v3 2/3] branch: add 'branch.namePrefix' config param VALERI Yoann via GitGitGadget
2026-03-07  7:07       ` Eric Sunshine
2026-03-06 13:14     ` [PATCH v3 3/3] branch: add '--no-name-prefix' option VALERI Yoann via GitGitGadget
2026-03-06 21:38       ` Junio C Hamano
2026-03-06 21:01     ` [PATCH v3 0/3] branch: add prefixes to new branch names Junio C Hamano
2026-03-07  7:05     ` Eric Sunshine
2026-03-08  6:48       ` Junio C Hamano

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=xmqqtsv2ru72.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=ps@pks.im \
    --cc=yoann.valeri@cea.fr \
    /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