X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=unpack-trees.c;h=cac2411b9de7b4889abe6b0b84df25d24a38c7e5;hb=a2f8028d3d661b314d5a784764f2f5f9e4c2dde0;hp=8a11622ccb58b192425b9300078e82760a6bce38;hpb=96a02f8f6d2192d3686cd1c719044082c89e8391;p=git.git diff --git a/unpack-trees.c b/unpack-trees.c index 8a11622cc..cac2411b9 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -264,10 +264,12 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len, * directories, in case this unlink is the removal of the * last entry in the directory -- empty directories are removed. */ -static void unlink_entry(char *name) +static void unlink_entry(char *name, char *last_symlink) { char *cp, *prev; + if (has_symlink_leading_path(name, last_symlink)) + return; if (unlink(name)) return; prev = NULL; @@ -291,11 +293,12 @@ static void unlink_entry(char *name) static struct checkout state; static void check_updates(struct cache_entry **src, int nr, - struct unpack_trees_options *o) + struct unpack_trees_options *o) { unsigned short mask = htons(CE_UPDATE); unsigned cnt = 0, total = 0; struct progress progress; + char last_symlink[PATH_MAX]; if (o->update && o->verbose_update) { for (total = cnt = 0; cnt < nr; cnt++) { @@ -304,17 +307,12 @@ static void check_updates(struct cache_entry **src, int nr, total++; } - /* Don't bother doing this for very small updates */ - if (total < 250) - total = 0; - - if (total) { - fprintf(stderr, "Checking files out...\n"); - start_progress(&progress, "", total); - } + start_progress_delay(&progress, "Checking %u files out...", + "", total, 50, 2); cnt = 0; } + *last_symlink = '\0'; while (nr--) { struct cache_entry *ce = *src++; @@ -323,13 +321,15 @@ static void check_updates(struct cache_entry **src, int nr, display_progress(&progress, ++cnt); if (!ce->ce_mode) { if (o->update) - unlink_entry(ce->name); + unlink_entry(ce->name, last_symlink); continue; } if (ce->ce_flags & mask) { ce->ce_flags &= ~mask; - if (o->update) + if (o->update) { checkout_entry(ce, &state, NULL); + *last_symlink = '\0'; + } } } if (total) @@ -414,10 +414,6 @@ static void verify_uptodate(struct cache_entry *ce, return; errno = 0; } - if (o->reset) { - ce->ce_flags |= htons(CE_UPDATE); - return; - } if (errno == ENOENT) return; die("Entry '%s' not uptodate. Cannot merge.", ce->name);