summaryrefslogtreecommitdiff
path: root/builtin-symbolic-ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-symbolic-ref.c')
-rw-r--r--builtin-symbolic-ref.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index bfc78bb3f6..ca855a5eb2 100644
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
@@ -36,7 +36,8 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
};
git_config(git_default_config, NULL);
- argc = parse_options(argc, argv, options, git_symbolic_ref_usage, 0);
+ argc = parse_options(argc, argv, prefix, options,
+ git_symbolic_ref_usage, 0);
if (msg &&!*msg)
die("Refusing to perform update with empty message");
switch (argc) {
@@ -44,6 +45,9 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
check_symref(argv[0], quiet);
break;
case 2:
+ if (!strcmp(argv[0], "HEAD") &&
+ prefixcmp(argv[1], "refs/"))
+ die("Refusing to point HEAD outside of refs/");
create_symref(argv[0], argv[1], msg);
break;
default: