All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Per Cederqvist <ceder@lysator.liu.se>, git@vger.kernel.org
Subject: Re: Allowing "/" in the name of a git remote is a strange choice
Date: Fri, 4 Jul 2025 07:13:12 +0200	[thread overview]
Message-ID: <aGdi6GRbI6Txm25Q@pks.im> (raw)
In-Reply-To: <xmqqikk8bltr.fsf@gitster.g>

On Thu, Jul 03, 2025 at 09:51:12PM -0700, Junio C Hamano wrote:
> Per Cederqvist <ceder@lysator.liu.se> writes:
> 
> > Today I realized that git accepts "/" in a remote name.
> >
> > This can lead to problems. I have a repository that contains a branch
> > called "master" and another called "chat/master". Just for fun, I
> > added a second remote in this repository and named it
> > "origin/chat".
> >
> > Now, does "refs/remotes/origin/chat/master" refer to the branch
> > "chat/master" from "origin", or the branch "master" from
> > "origin/chat"? Git seems to think it refers to both:
> 
> That would have been a fun experiment ;-)
> 
> > If it was up to me, I'd add a check to valid_remote_name() to ensure
> > the name doesn't contain any "/" character.  I doubt it is used often.
> 
> If your remote-naming discipline is to always use two-levels
> (e.g. origin/chat, origin/chien, origin/lapin but never origin or
> origin/chat/blanc mixed in), then there is no confusion.
> 
> It becomes only confusing if you mix origin and origin/chat.  
> 
> So it is not like we can just forbid '/' retroactively and expect no
> repercussions, especially given that I hear there are more than a
> few thousands of existing Git users in the world.

We cannot just blanket-disallow this now, true. But shouldn't Git be
able to detect this conflict, similar to how a user cannot have both
refs/heads/branch and refs/heads/branch/nested?

Patrick

  reply	other threads:[~2025-07-04  5:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03 19:33 Allowing "/" in the name of a git remote is a strange choice Per Cederqvist
2025-07-04  4:51 ` Junio C Hamano
2025-07-04  5:13   ` Patrick Steinhardt [this message]
2025-07-04  8:10     ` Lidong Yan
2025-07-04  8:17     ` Lidong Yan
2025-07-04 14:18     ` Junio C Hamano
2025-07-04  6:42   ` Per Cederqvist
2025-07-05 16:57 ` Jeff King
2025-07-05 18:58   ` [PATCH] remote: detect collisions in remote names Jeff King
2025-07-07  9:14     ` Patrick Steinhardt
2025-07-07 20:28       ` Jeff King
2025-07-07 21:04         ` Junio C Hamano
2025-07-08 22:59           ` Jeff King
2025-07-08 23:02             ` Jeff King
2025-07-08 23:28             ` Junio C Hamano
2025-07-09  1:21               ` Jeff King
2025-07-07 13:59     ` Junio C Hamano
2025-07-09 11:56     ` Raymond E. Pasco

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=aGdi6GRbI6Txm25Q@pks.im \
    --to=ps@pks.im \
    --cc=ceder@lysator.liu.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.