reset: improve mixed reset error message when in a bare repo
[gitweb.git] / builtin-reset.c
index 11d1c6e4d6d2ec0580cae3725f6b3a093e68aa67..3180c2b582073a7565e6be487302002f5f97b9a6 100644 (file)
@@ -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. */