diff options
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index 6bc9512a45..2a963f9a7f 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -62,17 +62,17 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, if (!strcmp(cmd, "checkout")) msg = advice_commit_before_merge ? _("Your local changes to the following files would be overwritten by checkout:\n%%s" - "Please commit your changes or stash them before you can switch branches.") + "Please commit your changes or stash them before you switch branches.") : _("Your local changes to the following files would be overwritten by checkout:\n%%s"); else if (!strcmp(cmd, "merge")) msg = advice_commit_before_merge ? _("Your local changes to the following files would be overwritten by merge:\n%%s" - "Please commit your changes or stash them before you can merge.") + "Please commit your changes or stash them before you merge.") : _("Your local changes to the following files would be overwritten by merge:\n%%s"); else msg = advice_commit_before_merge ? _("Your local changes to the following files would be overwritten by %s:\n%%s" - "Please commit your changes or stash them before you can %s.") + "Please commit your changes or stash them before you %s.") : _("Your local changes to the following files would be overwritten by %s:\n%%s"); msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOT_UPTODATE_FILE] = xstrfmt(msg, cmd, cmd); @@ -83,34 +83,34 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, if (!strcmp(cmd, "checkout")) msg = advice_commit_before_merge ? _("The following untracked working tree files would be removed by checkout:\n%%s" - "Please move or remove them before you can switch branches.") + "Please move or remove them before you switch branches.") : _("The following untracked working tree files would be removed by checkout:\n%%s"); else if (!strcmp(cmd, "merge")) msg = advice_commit_before_merge ? _("The following untracked working tree files would be removed by merge:\n%%s" - "Please move or remove them before you can merge.") + "Please move or remove them before you merge.") : _("The following untracked working tree files would be removed by merge:\n%%s"); else msg = advice_commit_before_merge ? _("The following untracked working tree files would be removed by %s:\n%%s" - "Please move or remove them before you can %s.") + "Please move or remove them before you %s.") : _("The following untracked working tree files would be removed by %s:\n%%s"); msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = xstrfmt(msg, cmd, cmd); if (!strcmp(cmd, "checkout")) msg = advice_commit_before_merge ? _("The following untracked working tree files would be overwritten by checkout:\n%%s" - "Please move or remove them before you can switch branches.") + "Please move or remove them before you switch branches.") : _("The following untracked working tree files would be overwritten by checkout:\n%%s"); else if (!strcmp(cmd, "merge")) msg = advice_commit_before_merge ? _("The following untracked working tree files would be overwritten by merge:\n%%s" - "Please move or remove them before you can merge.") + "Please move or remove them before you merge.") : _("The following untracked working tree files would be overwritten by merge:\n%%s"); else msg = advice_commit_before_merge ? _("The following untracked working tree files would be overwritten by %s:\n%%s" - "Please move or remove them before you can %s.") + "Please move or remove them before you %s.") : _("The following untracked working tree files would be overwritten by %s:\n%%s"); msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = xstrfmt(msg, cmd, cmd); @@ -123,9 +123,9 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, msgs[ERROR_SPARSE_NOT_UPTODATE_FILE] = _("Cannot update sparse checkout: the following entries are not up-to-date:\n%s"); msgs[ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN] = - _("The following Working tree files would be overwritten by sparse checkout update:\n%s"); + _("The following working tree files would be overwritten by sparse checkout update:\n%s"); msgs[ERROR_WOULD_LOSE_ORPHANED_REMOVED] = - _("The following Working tree files would be removed by sparse checkout update:\n%s"); + _("The following working tree files would be removed by sparse checkout update:\n%s"); opts->show_all_errors = 1; /* rejected paths may not have a static buffer */ @@ -218,8 +218,8 @@ static void unlink_entry(const struct cache_entry *ce) schedule_dir_for_removal(ce->name, ce_namelen(ce)); } -static struct checkout state; -static int check_updates(struct unpack_trees_options *o) +static int check_updates(struct unpack_trees_options *o, + const struct checkout *state) { unsigned cnt = 0, total = 0; struct progress *progress = NULL; @@ -264,7 +264,7 @@ static int check_updates(struct unpack_trees_options *o) display_progress(progress, ++cnt); ce->ce_flags &= ~CE_UPDATE; if (o->update && !o->dry_run) { - errs |= checkout_entry(ce, &state, NULL); + errs |= checkout_entry(ce, state, NULL); } } } @@ -1094,6 +1094,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options int i, ret; static struct cache_entry *dfc; struct exclude_list el; + struct checkout state; if (len > MAX_UNPACK_TREES) die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES); @@ -1239,7 +1240,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options } o->src_index = NULL; - ret = check_updates(o) ? (-2) : 0; + ret = check_updates(o, &state) ? (-2) : 0; if (o->dst_index) { if (!ret) { if (!o->result.cache_tree) |