summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b15b4a)
raw | patch | inline | side by side (parent: 4b15b4a)
author | Jeff King <peff@peff.net> | |
Fri, 13 Feb 2009 18:26:09 +0000 (13:26 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 14 Feb 2009 02:20:44 +0000 (18:20 -0800) |
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-symbolic-ref.c | patch | blob | history | |
t/t1401-symbolic-ref.sh | patch | blob | history |
diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index cafc4eba7cc0f8e2c89d49403b56bb746fe14545..6ae6bcc0e8d02d9af8a81a7d694c0bfd2c6c0514 100644 (file)
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
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:
index 569f34177d972e01f9ea567c4d65d70935e25052..7fa5f5b22a28f108b3063ff9920cffb530d950e6 100755 (executable)
--- a/t/t1401-symbolic-ref.sh
+++ b/t/t1401-symbolic-ref.sh
'
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`