From: Junio C Hamano <gitster@pobox.com>
To: Lazar Sumar <sumar@lazar.co.nz>
Cc: git@vger.kernel.org, Lazar Sumar <bugzilla@lazar.co.nz>
Subject: Re: [PATCH 0/1] New remote groups subcommand
Date: Mon, 05 May 2025 09:32:09 -0700 [thread overview]
Message-ID: <xmqqecx3ow6u.fsf@gitster.g> (raw)
In-Reply-To: <20250503160953.196329-1-bugzilla@lazar.co.nz> (Lazar Sumar's message of "Sat, 3 May 2025 17:09:51 +0100")
Lazar Sumar <sumar@lazar.co.nz> writes:
> Lastly, I wanted to at least add a test for the expected behavior of
> remote grups when a remote is renamed but found the current behavior
> surprising, i.e.
>
> $ git config --get-regexp 'remotes\.'
> file:.git/config remotes.group1 upstream origin
> $ git remote rename origin fork
> Renaming remote references: 100% (8/8), done.
> $ git config --get-regexp 'remotes\.'
> file:.git/config remotes.group1 upstream origin
>
> The remote group is defined in the local config file and I would expect
> the rename to rename the group member here.
Even for a single same person, depending on the reason why the
renaming of the underlying individual remote nickname is done, I
think the expectation is different. Perhaps they have a set of
remotes that they use for CI use (i.e., they push there to trigger
multiple CI platforms), that are named ci-alfa ci-beta etc. to make
it easier for them to identify these remotes, and grouped under "ci"
group, and they have another group they use for publishing (i.e.,
they push there and the latest history becomes available to their
developers), as "publish" group. Suppose they decide to retire the
CI infrastructure from the ci-alfa remote and use the repository
only for publishing. Then the config setting that may have looked
like this
[remotes]
ci = ci-alfa ci-beta ...
publish = north-america europe ...
would want to become
[remotes]
ci = ci-beta ...
publish = asia north-america europe ...
when they rename "ci-alfa" to "asia" because they no longer have
CI infrastructure attached to the repository to trigger, and instead
they want to use the repository to serve asian customers.
If "git remote rename ci-alfa asia" automatically rewrote the first
one to
[remotes]
ci = asia ci-beta ...
publish = north-america europe ...
it would not help anybody.
Of course, if the renaming is done to fix typo in the name of a
remote, e.g., "git remote rename ci-alfa ci-alpha", it would be
useful if the rename also rewrote the config into
[remotes]
ci = ci-alpha ci-beta ...
publish = north-america europe ...
but we cannot guess the intentions. So I am not sure if always
automatically rewriting is a good idea.
Before thinking about "rename" doing random things that the user may
or may not want to see perform automatically, I think it is better
to give users a way to exactly do what they want first. Perhaps a
session with those tools would look like this?
$ git remote group --list
ci
publish
$ git remote group --list --verbose
ci ci-alfa ci-beta
publish north-america europe
$ git remote group --get ci
ci-alfa
ci-beta
$ git remote group --set ci ci-alfa ci-beta
$ git remote group --get ci
ci-alpha
ci-beta
$ git remote group --list
ci
publish
$ git remote group --rename publish pub
$ git remote group --list
ci
pub
prev parent reply other threads:[~2025-05-05 16:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-03 16:09 [PATCH 0/1] New remote groups subcommand Lazar Sumar
2025-05-03 16:09 ` [PATCH 1/1] Add git remote group sub-command Lazar Sumar
2025-05-03 17:19 ` rsbecker
2025-05-05 16:32 ` Junio C Hamano [this message]
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=xmqqecx3ow6u.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=bugzilla@lazar.co.nz \
--cc=git@vger.kernel.org \
--cc=sumar@lazar.co.nz \
/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;
as well as URLs for NNTP newsgroup(s).