git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Allowing "/" in the name of a git remote is a strange choice
@ 2025-07-03 19:33 Per Cederqvist
  2025-07-04  4:51 ` Junio C Hamano
  2025-07-05 16:57 ` Jeff King
  0 siblings, 2 replies; 18+ messages in thread
From: Per Cederqvist @ 2025-07-03 19:33 UTC (permalink / raw)
  To: git; +Cc: Per Cederqvist

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:

> $ git fetch --all
> Fetching origin
> From $PRIVATE_URL
>  + 4e31956300f...30e26ebbb19 chat/master -> origin/chat/master  (forced update)
> Fetching origin/chat
> From  $PRIVATE_URL
>  + 30e26ebbb19...4e31956300f master     -> origin/chat/master  (forced update)

Every time I run "git fetch --all" git updates the origin/chat/master ref twice.

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.

    /ceder

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-07-09 11:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).