git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ingo Rohloff <ingo.rohloff@lauterbach.com>
To: git@vger.kernel.org
Cc: Ingo Rohloff <ingo.rohloff@lauterbach.com>
Subject: [PATCH v2 0/4] Do not create new refnames "refs" or "refs/*"
Date: Thu,  7 Nov 2019 20:07:46 +0100	[thread overview]
Message-ID: <20191107190750.26674-1-ingo.rohloff@lauterbach.com> (raw)
In-Reply-To: <20191106165628.28563-1-ingo.rohloff@lauterbach.com>

After the previous round of input:
The intention of this patch series is to make sure, that you always
might use "refs/<something>" to unambiguously refer to a specific 
reference.

Or put in another way: With this patch series, refnames for "git log", 
starting with "refs/" should never result in a
  warning: refname '...' is ambiguous.
Exceptions: 
You already have strangely named references in your repository.
You pull such strangely named references from a remote repository.

This patch series does not prevent you from creating various other
forms of ambiguous refnames. Example:

    git branch origin/master

This will very likely result in an ambiguity, because now the
references

   refs/heads/origin/master
   refs/remotes/origin/master

will very likely both exist. "origin/master" matches both refnames.

This patch series forbids to create new reference names, which start
with "refs" or "refs/*" with the commands

  git branch <name>
  git checkout -b <name>
  git tag <name>
  git remote add <name>

Note: This patch does NOT prevent you from working with references
which already exist.  It just prevents you from creating new ones
with the commands listed above.

That's also the reason why the '--force' option is not evaluated here.
I cannot think of a good reason, why you ever should want to create
refnames matching any of the following patterns:
   refs/heads/refs/*
   refs/tags/refs/*
   refs/remotes/refs/*
  

Ingo Rohloff (4):
  refs: new function newname_has_bad_prefix
  branch: Prevent creation of local branches named "refs" or "refs/*"
  remote: Prevent users from creating remotes named "refs" or "refs/*"
  tag: Prevent users from creating tags named "refs" or "refs/*"

 builtin/branch.c   |  6 ++++++
 builtin/checkout.c |  3 +++
 builtin/remote.c   |  3 +++
 builtin/tag.c      |  3 +++
 refs.c             | 30 ++++++++++++++++++++++++++++++
 refs.h             |  2 ++
 6 files changed, 47 insertions(+)

-- 
2.24.0


  parent reply	other threads:[~2019-11-07 19:08 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
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 ` Ingo Rohloff [this message]
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=20191107190750.26674-1-ingo.rohloff@lauterbach.com \
    --to=ingo.rohloff@lauterbach.com \
    --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).