symbolic-ref: allow refs/<whatever> in HEAD
Commitafe5d3d5
introduced a safety valve to symbolic-ref to disallow installing an invalid HEAD. It was accompanied byb229d18a
, 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 inb229d18a
. 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>
This commit is contained in:
parent
4b15b4ab5f
commit
e9cc02f0e4
@ -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:
|
||||
|
@ -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`
|
||||
|
Loading…
Reference in New Issue
Block a user