]> git.ipfire.org Git - thirdparty/git.git/blobdiff - read-cache.c
l10n: tr: v2.33 (round 2)
[thirdparty/git.git] / read-cache.c
index 0c3ac3cefc070f2082a6afe93d03402b4780ba2d..9048ef9e905251bacb516be6afdb474b4e59648f 100644 (file)
@@ -27,6 +27,7 @@
 #include "progress.h"
 #include "sparse-index.h"
 #include "csum-file.h"
+#include "promisor-remote.h"
 
 /* Mask for the name length in ce_flags in the on-disk index */
 
@@ -1585,8 +1586,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
         */
        preload_index(istate, pathspec, 0);
        trace2_region_enter("index", "refresh", NULL);
-       /* TODO: audit for interaction with sparse-index. */
-       ensure_full_index(istate);
+
        for (i = 0; i < istate->cache_nr; i++) {
                struct cache_entry *ce, *new_entry;
                int cache_errno = 0;
@@ -1601,6 +1601,13 @@ int refresh_index(struct index_state *istate, unsigned int flags,
                if (ignore_skip_worktree && ce_skip_worktree(ce))
                        continue;
 
+               /*
+                * If this entry is a sparse directory, then there isn't
+                * any stat() information to update. Ignore the entry.
+                */
+               if (S_ISSPARSEDIR(ce->ce_mode))
+                       continue;
+
                if (pathspec && !ce_path_match(istate, ce, pathspec, seen))
                        filtered = 1;
 
@@ -2233,7 +2240,8 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
 
        mmap = xmmap_gently(NULL, mmap_size, PROT_READ, MAP_PRIVATE, fd, 0);
        if (mmap == MAP_FAILED)
-               die_errno(_("%s: unable to map index file"), path);
+               die_errno(_("%s: unable to map index file%s"), path,
+                       mmap_os_err());
        close(fd);
 
        hdr = (const struct cache_header *)mmap;
@@ -2498,6 +2506,7 @@ int repo_index_has_changes(struct repository *repo,
                opt.flags.exit_with_status = 1;
                if (!sb)
                        opt.flags.quick = 1;
+               diff_setup_done(&opt);
                do_diff_cache(&cmp, &opt);
                diffcore_std(&opt);
                for (i = 0; sb && i < diff_queued_diff.nr; i++) {
@@ -3656,3 +3665,25 @@ static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_ta
                strbuf_add(sb, &buffer, sizeof(uint32_t));
        }
 }
+
+void prefetch_cache_entries(const struct index_state *istate,
+                           must_prefetch_predicate must_prefetch)
+{
+       int i;
+       struct oid_array to_fetch = OID_ARRAY_INIT;
+
+       for (i = 0; i < istate->cache_nr; i++) {
+               struct cache_entry *ce = istate->cache[i];
+
+               if (S_ISGITLINK(ce->ce_mode) || !must_prefetch(ce))
+                       continue;
+               if (!oid_object_info_extended(the_repository, &ce->oid,
+                                             NULL,
+                                             OBJECT_INFO_FOR_PREFETCH))
+                       continue;
+               oid_array_append(&to_fetch, &ce->oid);
+       }
+       promisor_remote_get_direct(the_repository,
+                                  to_fetch.oid, to_fetch.nr);
+       oid_array_clear(&to_fetch);
+}