apply: do not read from the filesystem under --index
[gitweb.git] / builtin / apply.c
index 8561236d04fabb9b81494325def4b7d0f2a5c22a..21e45a0f10939117fee4bad6bf6a61df3c653096 100644 (file)
@@ -3136,7 +3136,7 @@ static int load_patch_target(struct strbuf *buf,
                             const char *name,
                             unsigned expected_mode)
 {
-       if (cached) {
+       if (cached || check_index) {
                if (read_file_or_gitlink(ce, buf))
                        return error(_("read of %s failed"), name);
        } else if (name) {