Thread (14 messages) flat view 14 messages, 7 authors, 2016-06-15

Re: [topgit] tg update error

From: Jeff King <hidden>
Date: 2016-06-15 22:46:10
Subsystem: the rest · Maintainer: Linus Torvalds

On Thu, Feb 12, 2009 at 01:01:42PM -0800, Junio C Hamano wrote:
quoted
Junio, I think we should probably revert b229d18 (and loosen
symbolic-ref's check to just "refs/"). Even if you want to argue that
topgit should be changed to handle this differently, we are still
breaking existing topgit installations, and who knows what other scripts
which might have relied on doing something like this.
I'm Ok with the revert (and I agree it is absolutely the right thing to do
at least for the short term).
It looks like you have already pushed out the revert. But I think we
need this on top to make topgit work correctly.

-- >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/.
Therefore, the safety valve also checked for refs/heads/.

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 valve,
so that the two are in agreement once more.

Signed-off-by: Jeff King <redacted>
---
 builtin-symbolic-ref.c |    4 ++--
 1 files changed, 2 insertions(+), 2 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:
-- 
1.6.2.rc0.241.g088a
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help