Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-09-13 01:34:35 +0300
committerJunio C Hamano <gitster@pobox.com>2016-09-13 01:34:35 +0300
commitd1de693d0d83b2d0d12320312ae523c7711bf627 (patch)
tree5cb1723525e1addde44e716de2471efc5826aa3b /builtin
parent293c232ab1dcfa08d650fa9c21377b1ef7b447dc (diff)
parent12cfa792b8657cfd37523df83df0a83d987570a5 (diff)
Merge branch 'jc/forbid-symbolic-ref-d-HEAD'
"git symbolic-ref -d HEAD" happily removes the symbolic ref, but the resulting repository becomes an invalid one. Teach the command to forbid removal of HEAD. * jc/forbid-symbolic-ref-d-HEAD: symbolic-ref -d: do not allow removal of HEAD
Diffstat (limited to 'builtin')
-rw-r--r--builtin/symbolic-ref.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index 9c29a64e43..96eed94468 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -56,6 +56,8 @@ 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]);
+ if (!strcmp(argv[0], "HEAD"))
+ die("deleting '%s' is not allowed", argv[0]);
return delete_ref(argv[0], NULL, REF_NODEREF);
}