From: Ingo Rohloff <ingo.rohloff@lauterbach.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] branch: Forbid to create local branches with confusing names
Date: Thu, 7 Nov 2019 20:04:21 +0100 [thread overview]
Message-ID: <20191107200421.6214b2e1@ingpc3.intern.lauterbach.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1911062101580.46@tvgsbejvaqbjf.bet>
Hello Johannes,
On Wed, 6 Nov 2019 23:15:44 +0100 (CET)
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi Ingo,
>
> On Wed, 6 Nov 2019, Ingo Rohloff wrote:
>
> > Without this patch, git allows to do something like this:
>
> Maybe start the patch with a description of the problem it tries to
> solve? In other words, I would have appreciated a first paragraph that
> starts with "Many Git users ...".
That's actually one of the problems:
It's not clear what exactly the problem is :-).
After thinking about it more: The minimal goal I can think of is to make sure
that if you use
git log refs/<something>
you will never get a
warning: refname '...' is ambiguous
Rationale behind that: If even "refs/<something>" gives you this warning,
then you might be in a lot of trouble. It means even giving a "full" refname
is not enough to resolve ambiguities.
I think this is bad, because it means it might be hard to get out of this
situation, because you might get the "ambiguous" warnings when you try to
get rid of the offending refnames.
>
> A lot of this text should probably go into the commit message itself,
> possibly with accompanying Message-IDs or even public-inbox URLs right
> away.
I did read "Documentation/SubmittingPatches". There it says:
Try to make sure your explanation can be understood
without external resources. Instead of giving a URL to a
mailing list archive, summarize the relevant points of
the discussion.
so that's what I tried to do.
>
> A more common problem for me, personally, is when I manage to fool
> myself by creating a local branch like `origin/master`. Clearly, I want
> to refer to the remote-tracking branch, but by mistake I create a local
> branch that now conflicts with the (short) name of the remote-tracking
> branch.
>
> To remedy this, you would not only have to ensure that `create_branch()`
> verifies that the branch name does not have a `<remote-name>/` prefix
> where `<remote-name>` refers to a valid remote, but you would also need
> a corresponding patch that teaches `git add remote <nick> <url>` to
> verify that no local branch starts with `<nick>/`.
>
> What do you think?
>
I agree: When I first started to use git, I was quite surprised that this
"double naming" is allowed.
But I also think, this is for another patch series; you probably need to
honor "--force", or even add a git configuration option to allow this
anyway.
I am able to imagine that people intentionally set up a local branch
called "refs/heads/repoX/master" which tracks "refs/remotes/repoX/master".
For me this sounds like an unnecessary complication (because now you always
have to use the "long" refname), but if you put some software on top of git,
I can imagine that this might make a lot of sense...
I am not enough of a git wizard to fully grasp the implications here.
so long
Ingo
next prev parent reply other threads:[~2019-11-07 19:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-06 16:56 [PATCH] branch: Forbid to create local branches with confusing names Ingo Rohloff
2019-11-06 22:15 ` Johannes Schindelin
2019-11-07 19:04 ` Ingo Rohloff [this message]
2019-11-07 6:05 ` Junio C Hamano
2019-11-07 12:54 ` Ingo Rohloff
2019-11-08 2:54 ` Junio C Hamano
2019-11-08 12:45 ` Ingo Rohloff
2019-11-07 19:07 ` [PATCH v2 0/4] Do not create new refnames "refs" or "refs/*" Ingo Rohloff
2019-11-07 19:07 ` [PATCH v2 1/4] refs: new function newname_has_bad_prefix Ingo Rohloff
2019-11-07 19:07 ` [PATCH v2 2/4] branch: Prevent creation of local branches named "refs" or "refs/*" Ingo Rohloff
2019-11-07 19:07 ` [PATCH v2 3/4] remote: Prevent users from creating remotes " Ingo Rohloff
2019-11-07 19:07 ` [PATCH v2 4/4] tag: Prevent users from creating tags " Ingo Rohloff
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191107200421.6214b2e1@ingpc3.intern.lauterbach.com \
--to=ingo.rohloff@lauterbach.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).