git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: Jeff King <peff@peff.net>, Brandon Casey <casey@nrlssc.navy.mil>,
	git@vger.kernel.org
Subject: Re: [PATCH 0/3] symref rename/delete fixes
Date: Sun, 26 Oct 2008 22:31:09 -0700	[thread overview]
Message-ID: <7vhc6yioyq.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: cover.1224987944.git.vmiklos@frugalware.org

Miklos Vajna <vmiklos@frugalware.org> writes:

> A symref-aware rename_ref() is needed by git remove rename, since it
> typically does origin/HEAD -> upstream/HEAD symref renames there.
>
> Of course you can say that this should be handled by git-remote itself,
> without using rename_ref() but that not seem to be a good solution to
> me. (Workaround in the wrong layer, instead of a solution in a good
> one.)

I do not think it is a workaround at all.

I would even say that the renaming of symref that "git remote rename"
needs to do is fundamentally different from what rename_ref() is about,
and trying to cram it into rename_ref() is a grave mistake.

If you "git remote rename origin upstream" when origin/HEAD points at
refs/remotes/origin/master, you need to make the renamed one point at
refs/remotes/upstream/master, as you will be renaming origin/master to
upstream/master.

Normal "rename_ref()" would just rename the ref without touching its
contents, and if you used it to implement "git remote rename", your
upstream/HEAD would point at the old name "origin/master" that will
disappear when rename is finished, wouldn't it?  I do not think it is
useful.

There may be cases where you would really want to rename the symbolic ref
without changing its value (e.g. which other ref it points at), but as you
mentioned, even "git branch -m" is not such a usecase.

I think it is better to simply forbid renaming of a symref _until_ we know
what we want it to mean.  It is a lot easier to start strict and then add
features, than start loosely and implement an unclean semantics, and then
having to fix that semantics after people start to rely on the initial
(potentially crazy) semantics.

  parent reply	other threads:[~2008-10-27  5:32 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-22  0:23 [PATCH] Implement git remote mv Miklos Vajna
2008-10-22 16:52 ` Brandon Casey
2008-10-23  1:18   ` Miklos Vajna
2008-10-23  3:52     ` Jeff King
2008-10-23 12:56       ` [PATCH] Implement git remote rename Miklos Vajna
2008-10-24 23:33         ` Junio C Hamano
2008-10-25 12:58           ` [PATCH 0/2] Fixes for git branch -m / update-ref --no-deref -d Miklos Vajna
2008-10-25 12:58             ` [PATCH 1/2] Fix git branch -m for symrefs Miklos Vajna
2008-10-25 12:58               ` [PATCH 2/2] Fix git update-ref --no-deref -d Miklos Vajna
2008-10-25 18:31               ` [PATCH 1/2] Fix git branch -m for symrefs Junio C Hamano
2008-10-26  2:33                 ` [PATCH 0/3] symref rename/delete fixes Miklos Vajna
2008-10-26  2:33                   ` [PATCH 1/3] Fix git branch -m for symrefs Miklos Vajna
2008-10-26  2:33                     ` [PATCH 2/3] rename_ref(): handle the case when the reflog of a ref does not exist Miklos Vajna
2008-10-26  2:33                       ` [PATCH 3/3] Fix git update-ref --no-deref -d Miklos Vajna
2008-10-27  5:31                   ` Junio C Hamano [this message]
2008-10-27  8:50                     ` [PATCH 0/3] symref rename/delete fixes Miklos Vajna
2008-10-27 19:50                       ` Miklos Vajna
2008-10-27 19:50                         ` [PATCH 1/3] Disallow git branch -m for symrefs Miklos Vajna
2008-10-27 19:50                           ` [PATCH 2/3] rename_ref(): handle the case when the reflog of a ref does not exist Miklos Vajna
2008-10-27 19:50                             ` [PATCH 3/3] Fix git update-ref --no-deref -d Miklos Vajna
2008-10-28 23:45                         ` [PATCH 0/3] symref rename/delete fixes Miklos Vajna
2008-10-29  0:05                           ` [PATCH] git branch -m: forbid renaming of a symref Miklos Vajna
2008-11-03 18:26           ` [PATCH] Implement git remote rename Miklos Vajna
2008-11-10 20:42           ` Miklos Vajna
2008-11-10 20:43             ` [PATCH 1/4] remote: add a new 'origin' variable to the struct Miklos Vajna
2008-11-10 20:43               ` [PATCH 2/4] git-remote rename: support remotes->config migration Miklos Vajna
2008-11-10 20:43                 ` [PATCH 3/4] git-remote rename: support branches->config migration Miklos Vajna
2008-11-10 20:43                   ` [PATCH 4/4] git-remote: document the migration feature of the rename subcommand Miklos Vajna
2008-11-12  0:49                   ` [PATCH 3/4] git-remote rename: support branches->config migration Junio C Hamano
2008-11-12  2:01                     ` Miklos Vajna
2008-11-12  4:22                       ` Junio C Hamano
2008-11-12 17:11                         ` [PATCH v2 0/4] " Miklos Vajna
2008-11-12 17:11                           ` [PATCH 1/4] remote: add a new 'origin' variable to the struct Miklos Vajna
2008-11-12 17:11                             ` [PATCH 2/4] git-remote rename: support remotes->config migration Miklos Vajna
2008-11-12 17:11                               ` [PATCH 3/4] git-remote rename: support branches->config migration Miklos Vajna
2008-11-12 17:11                                 ` [PATCH 4/4] git-remote: document the migration feature of the rename subcommand Miklos Vajna

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vhc6yioyq.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=casey@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=vmiklos@frugalware.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.
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).