Subject: Re: [PATCH 3/3] completion: fix bugs with slashes in remote names

From: Junio C Hamano <[email-masked]>
Date: Fri, 07 Mar 2025 12:57:44 -0800

David Mandelberg <[email-masked]> writes:

> I'm not sure if I'm remembering right, but I think I got the idea from
> seeing slashes in branch names to organize a hierarchy of branches,
> and realizing I could do the same with remotes. Was it intentional to
> allow slash in branch names, or is that a similar situation?

Reference names were hierarchical pretty much from the beginning.

>> Anyway, this is not something we'd do lightly, but we may want to
>> see if we should tighten the naming rules for remote nicknames and
>> the mapping from nicknames to remote-tracking hiearchy, at Git 3.0
>> version boundary.
>
> What does that mean for this patch now? Do you want to fix the
> completion for the currently (unintentionally) supported remote names,
> or leave it broken to discourage their use? Fixing the completion
> might also give anybody reading the completion script the idea that
> slashes in remote names are somewhat sanctioned.

It probably would not mean much either way, and certainly not
something we should worry about during pre-release feature freeze.

The "fix" may take quite different shapes.  Remote nick/name may
still be allowed but the default fetch refspec left by "git clone"
would start using the refs/remotes/nick-name/ hierarchy instead of
the refs/remotes/nick/name hierarchy, for example, but as long as
this round of completion fixes properly read the configuration to
learn the remote-tracking hierarchy by reading the configured value
of "remote.nick/name.fetch", such a change would not break the code
in the completion script at all.  Or remote nick/name may outright
banned and people are encouraged to use nick-name instead, in which
case even if the completion code is prepared to accept remote names
with slashes in it, as long as it still works correctly with remote
names with no slashes in it, it will keep working in such a future.

Or the "fix" may be to declare "there is nothing to fix, if people
want to use

    [remote "nick/name"] fetch = +refs/heads/*:refs/remotes/nickname/*
    [remote "nocknyme"] fetch = +refs/heads/*:refs/remotes/nock/nyme/*

that's their choice, and the completion code would do the right thing
anyway".

I didn't read your patches, so the situation may be different and
with any shape of "fix", or without any "fix", there might still be
need for further polishing.  But hopefully you got the idea.  For
this particular patch, there is nothing urgently needed.  Well, we
are right now in the pre-release feature freeze anyway ;-).

Thanks.