diff options
Diffstat (limited to 'builtin/symbolic-ref.c')
-rw-r--r-- | builtin/symbolic-ref.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index ce0fde705c..70addef158 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -56,7 +56,9 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) ret = check_symref(argv[0], 1, 0, 0); if (ret) die("Cannot delete %s, not a symbolic ref", argv[0]); - return delete_ref(argv[0], NULL, REF_NODEREF); + if (!strcmp(argv[0], "HEAD")) + die("deleting '%s' is not allowed", argv[0]); + return delete_ref(NULL, argv[0], NULL, REF_NODEREF); } switch (argc) { @@ -67,7 +69,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) if (!strcmp(argv[0], "HEAD") && !starts_with(argv[1], "refs/")) die("Refusing to point HEAD outside of refs/"); - create_symref(argv[0], argv[1], msg); + ret = !!create_symref(argv[0], argv[1], msg); break; default: usage_with_options(git_symbolic_ref_usage, options); |