Merge branch 'doc-style/for-next' of git://repo.or.cz/git/trast
[gitweb.git] / builtin-clean.c
index 28cdcd0274dd5891c7ad3dc3804cb0acead883f2..3a70fa81bdd8f0e087476560f7c2f668a3cda0ea 100644 (file)
@@ -75,11 +75,13 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 
        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);