git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Aneesh Kumar <aneesh.kumar@gmail.com>,
	madduck@debian.org, git@vger.kernel.org
Subject: Re: [topgit] tg update error
Date: Fri, 13 Feb 2009 21:24:36 -0500	[thread overview]
Message-ID: <20090214022436.GC9907@coredump.intra.peff.net> (raw)
In-Reply-To: <7vocx53gqw.fsf@gitster.siamese.dyndns.org>

On Fri, Feb 13, 2009 at 06:16:23PM -0800, Junio C Hamano wrote:

> > Is there any reason to throw away the "must be in refs/" safety valve,
> > though? That was the actual patch I started with and solved my problem,
> > and the "tighten to refs/heads/" bit came from discussion. That is, I
> > think having a safety valve in symbolic-ref that matches
> > validate_headref is orthogonal to how tightly validate_headref matches.
> >
> > But yes, I obviously failed to run the test suite on the follow-up patch
> > I sent. The final test in t1401 would need to be reverted, as well.
> 
> Sure.

OK, here is the updated patch (that actually passes the test suite).

-- >8 --
Subject: [PATCH] symbolic-ref: allow refs/<whatever> in HEAD

Commit afe5d3d5 introduced a safety valve to symbolic-ref to
disallow installing an invalid HEAD. It was accompanied by
b229d18a, which changed validate_headref to require that
HEAD contain a pointer to refs/heads/ instead of just refs/.

As it turns out, topgit is using refs/top-bases/ in HEAD,
leading us to re-loosen (at least temporarily) the
validate_headref check made in b229d18a. This patch does the
corresponding loosening for the symbolic-ref safety check,
so that the two are in agreement once more.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin-symbolic-ref.c  |    4 ++--
 t/t1401-symbolic-ref.sh |    5 -----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index cafc4eb..6ae6bcc 100644
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
@@ -45,8 +45,8 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
 		break;
 	case 2:
 		if (!strcmp(argv[0], "HEAD") &&
-		    prefixcmp(argv[1], "refs/heads/"))
-			die("Refusing to point HEAD outside of refs/heads/");
+		    prefixcmp(argv[1], "refs/"))
+			die("Refusing to point HEAD outside of refs/");
 		create_symref(argv[0], argv[1], msg);
 		break;
 	default:
diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
index 569f341..7fa5f5b 100755
--- a/t/t1401-symbolic-ref.sh
+++ b/t/t1401-symbolic-ref.sh
@@ -27,11 +27,6 @@ test_expect_success 'symbolic-ref refuses non-ref for HEAD' '
 '
 reset_to_sane
 
-test_expect_success 'symbolic-ref refuses non-branch for HEAD' '
-	test_must_fail git symbolic-ref HEAD refs/foo
-'
-reset_to_sane
-
 test_expect_success 'symbolic-ref refuses bare sha1' '
 	echo content >file && git add file && git commit -m one
 	test_must_fail git symbolic-ref HEAD `git rev-parse HEAD`
-- 
1.6.2.rc0.241.g088a

      reply	other threads:[~2009-02-14  2:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12  8:09 [topgit] tg update error Aneesh Kumar
2009-02-12  8:48 ` martin f krafft
2009-02-12  9:25   ` Aneesh Kumar K.V
2009-02-12  9:32     ` martin f krafft
2009-02-12 10:12       ` Aneesh Kumar K.V
2009-02-12 11:29       ` Bert Wesarg
2009-02-12 12:56     ` Jeff King
2009-02-12 12:59       ` Jeff King
2009-02-12 21:01         ` martin f krafft
2009-02-12 21:01       ` Junio C Hamano
2009-02-12 21:41         ` martin f krafft
2009-02-12 23:14           ` Junio C Hamano
2009-02-13  6:28             ` martin f krafft
2009-02-13  7:32               ` Junio C Hamano
2009-02-13  9:04                 ` Junio C Hamano
2009-02-13 18:26         ` Jeff King
2009-02-14  2:02           ` Junio C Hamano
2009-02-14  2:08             ` Jeff King
2009-02-14  2:16               ` Junio C Hamano
2009-02-14  2:24                 ` Jeff King [this message]

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=20090214022436.GC9907@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=aneesh.kumar@gmail.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madduck@debian.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).