From: Junio C Hamano Date: Tue, 22 Jun 2010 16:45:22 +0000 (-0700) Subject: Merge branch 'bd/maint-unpack-trees-parawalk-fix' X-Git-Tag: v1.7.2-rc0~14 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3919d40cfb23b2c763a4979c4a1512424adc8442?ds=inline;hp=-c Merge branch 'bd/maint-unpack-trees-parawalk-fix' * bd/maint-unpack-trees-parawalk-fix: unpack-trees: Make index lookahead less pessimal --- 3919d40cfb23b2c763a4979c4a1512424adc8442 diff --combined unpack-trees.c index 85045fd03f,fe2340892a..8cf0da317d --- a/unpack-trees.c +++ b/unpack-trees.c @@@ -67,8 -67,16 +67,8 @@@ static void unlink_entry(struct cache_e { if (has_symlink_or_noent_leading_path(ce->name, ce_namelen(ce))) return; - if (S_ISGITLINK(ce->ce_mode)) { - if (rmdir(ce->name)) { - warning("unable to rmdir %s: %s", - ce->name, strerror(errno)); - return; - } - } - else - if (unlink_or_warn(ce->name)) - return; + if (remove_or_warn(ce->ce_mode, ce->name)) + return; schedule_dir_for_removal(ce->name, ce_namelen(ce)); } @@@ -279,11 -287,9 +279,11 @@@ static void add_same_unmerged(struct ca static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_options *o) { - struct cache_entry *src[5] = { ce, NULL, }; + struct cache_entry *src[5] = { NULL }; int ret; + src[0] = ce; + mark_ce_used(ce, o); if (ce_stage(ce)) { if (o->skip_unmerged) { @@@ -522,9 -528,17 +522,17 @@@ static int find_cache_pos(struct traver const char *ce_name, *ce_slash; int cmp, ce_len; - if (!ce_in_traverse_path(ce, info)) + if (ce->ce_flags & CE_UNPACKED) { + /* + * cache_bottom entry is already unpacked, so + * we can never match it; don't check it + * again. + */ + if (pos == o->cache_bottom) + ++o->cache_bottom; continue; - if (ce->ce_flags & CE_UNPACKED) + } + if (!ce_in_traverse_path(ce, info)) continue; ce_name = ce->name + pfxlen; ce_slash = strchr(ce_name, '/'); @@@ -856,7 -870,7 +864,7 @@@ static int verify_uptodate_1(struct cac { struct stat st; - if (o->index_only || (!ce_skip_worktree(ce) && (o->reset || ce_uptodate(ce)))) + if (o->index_only || (!((ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) && (o->reset || ce_uptodate(ce)))) return 0; if (!lstat(ce->name, &st)) {