git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] Fixes for git branch -m / update-ref --no-deref -d

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Oct 25, 2008, 12:58 UTC
Message-ID
<cover.1224939436.git.vmiklos@frugalware.org>
In-Reply-To
<7v63nh1sc7.fsf@gitster.siamese.dyndns.org>
On Fri, Oct 24, 2008 at 04:33:28PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> Hmm, remote_get() can read from all three supported places that you
> can
> define remotes.  Could you explain what happens if the old remote is
> read
> from say $GIT_DIR/remotes/origin and you are renaming it to "upstream"
> with "git remote rename origin upstream"?

While trying to answer your question, I noticed that rename_ref()/delete_ref() did not really handled symrefs.

Regarding rename_ref() (for users: git branch -m) I think you can't create symrefs in the refs/heads namespace without using plumbing, so most users are not affected.

Regarding delete_ref() (for users: git update-ref --no-deref -d) in most repos you just have HEAD as symref and you never want to delete it, but in case the user asks for it, I think we just have to do so.

Here are two patches to fix these issues (and in fact they will be required for git remote rename as well).

Miklos Vajna (2):
  Fix git branch -m for symrefs.
  Fix git update-ref --no-deref -d.
 builtin-branch.c       |    2 +-
 builtin-receive-pack.c |    2 +-
 builtin-remote.c       |    4 +-
 builtin-reset.c        |    2 +-
 builtin-send-pack.c    |    2 +-
 builtin-tag.c          |    2 +-
 builtin-update-ref.c   |    8 ++++--
 cache.h                |    2 +-
 refs.c                 |   56 ++++++++++++++++++++++++++++++------------------
 t/t1400-update-ref.sh  |    7 ++++++
 t/t3200-branch.sh      |    9 +++++++
 11 files changed, 64 insertions(+), 32 deletions(-)
Next: Miklos Vajna
Message 1 of 4 in “Fixes for git branch -m / update-ref --no-deref -d”
  1. 0/2 Fixes for git branch -m / update-ref --no-deref -dMiklos Vajna, Oct 25, 2008
  2. 1/2 Fix git branch -m for symrefs.Miklos Vajna, Oct 25, 2008
  3. 2/2 Fix git update-ref --no-deref -d.Miklos Vajna, Oct 25, 2008
  4. Junio C HamanoOct 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.