X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=preload-index.c;h=49cb08df96faa90101bb25d8f96acaffc066f19b;hb=aa3982890fe7506badfddf6252402a335a4d72b7;hp=88edc5f8a9d5384e19426e6adb40e08b34d3adf2;hpb=77f143bf3e218857ec8e5244d7e862e8e0c1a041;p=git.git diff --git a/preload-index.c b/preload-index.c index 88edc5f8a..49cb08df9 100644 --- a/preload-index.c +++ b/preload-index.c @@ -34,7 +34,11 @@ static void *preload_thread(void *_data) struct thread_data *p = _data; struct index_state *index = p->index; struct cache_entry **cep = index->cache + p->offset; + struct cache_def cache; + struct pathspec pathspec; + init_pathspec(&pathspec, p->pathspec); + memset(&cache, 0, sizeof(cache)); nr = p->nr; if (nr + p->offset > index->cache_nr) nr = index->cache_nr - p->offset; @@ -45,9 +49,13 @@ static void *preload_thread(void *_data) if (ce_stage(ce)) continue; + if (S_ISGITLINK(ce->ce_mode)) + continue; if (ce_uptodate(ce)) continue; - if (!ce_path_match(ce, p->pathspec)) + if (!ce_path_match(ce, &pathspec)) + continue; + if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce))) continue; if (lstat(ce->name, &st)) continue; @@ -55,6 +63,7 @@ static void *preload_thread(void *_data) continue; ce_mark_uptodate(ce); } while (--nr > 0); + free_pathspec(&pathspec); return NULL; } @@ -72,7 +81,7 @@ static void preload_index(struct index_state *index, const char **pathspec) if (threads > MAX_PARALLEL) threads = MAX_PARALLEL; offset = 0; - work = (index->cache_nr + threads - 1) / threads; + work = DIV_ROUND_UP(index->cache_nr, threads); for (i = 0; i < threads; i++) { struct thread_data *p = data+i; p->index = index;