Code

Makefile: Remove usage of deprecated Python "has_key" method
[git.git] / builtin-clean.c
index 28cdcd0274dd5891c7ad3dc3804cb0acead883f2..fac64e6cd3717dfffb0f54124de9545f7cdc391a 100644 (file)
@@ -67,19 +67,21 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
                die("-x and -X cannot be used together");
 
        if (!show_only && !force)
-               die("clean.requireForce%s set and -n or -f not given; "
-                   "refusing to clean", config_set ? "" : " not");
+               die("clean.requireForce %s to true and neither -n nor -f given; "
+                   "refusing to clean", config_set ? "set" : "defaults");
 
        if (force > 1)
                rm_flags = 0;
 
        dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
 
+       if (read_cache() < 0)
+               die("index file corrupt");
+
        if (!ignored)
                setup_standard_excludes(&dir);
 
        pathspec = get_pathspec(prefix, argv);
-       read_cache();
 
        fill_directory(&dir, pathspec);