Signed-off-by: Stefan Beller <sbel...@google.com>
---
 builtin/checkout-index.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index a730f6a1aa4..aaba99d36c0 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -10,6 +10,7 @@
 #include "quote.h"
 #include "cache-tree.h"
 #include "parse-options.h"
+#include "repository.h"
 
 #define CHECKOUT_ALL 4
 static int nul_term_line;
@@ -184,9 +185,7 @@ int cmd_checkout_index(int argc, const char **argv, const 
char *prefix)
        git_config(git_default_config, NULL);
        prefix_length = prefix ? strlen(prefix) : 0;
 
-       if (read_cache() < 0) {
-               die("invalid cache");
-       }
+       repo_read_index_or_die(the_repository);
 
        argc = parse_options(argc, argv, prefix, builtin_checkout_index_options,
                        builtin_checkout_index_usage, 0);
-- 
2.17.0.582.gccdcbd54c44.dirty

Reply via email to