summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-reset.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin-reset.c b/builtin-reset.c
index 11d1c6e4d6..3180c2b582 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -291,6 +291,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
die("%s reset requires a work tree",
reset_type_names[reset_type]);
+ if (reset_type == MIXED && is_bare_repository())
+ die("%s reset is not allowed in a bare repository",
+ reset_type_names[reset_type]);
+
/* Soft reset does not touch the index file nor the working tree
* at all, but requires them in a good order. Other resets reset
* the index file to the tree object we are switching to. */