Skip to content

Commit 87c9831

Browse files
committed
Merge branch 'nd/checkout-noisy-unmerge'
"git checkout [<tree-ish>] <pathspec>" started reporting the number of paths that have got updated recently, but the same messages were given when "git checkout -m <pathspec>" to unresolve conflicts that have just been resolved. The message now reports these unresolved paths separately from the paths that are checked out from the index. * nd/checkout-noisy-unmerge: checkout: count and print -m paths separately checkout: update count-checkouts messages
2 parents fd357c4 + 1d1f689 commit 87c9831

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

builtin/checkout.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static int checkout_paths(const struct checkout_opts *opts,
261261
struct commit *head;
262262
int errs = 0;
263263
struct lock_file lock_file = LOCK_INIT;
264-
int nr_checkouts = 0;
264+
int nr_checkouts = 0, nr_unmerged = 0;
265265

266266
if (opts->track != BRANCH_TRACK_UNSPECIFIED)
267267
die(_("'%s' cannot be used with updating paths"), "--track");
@@ -386,23 +386,28 @@ static int checkout_paths(const struct checkout_opts *opts,
386386
&state, &nr_checkouts);
387387
else if (opts->merge)
388388
errs |= checkout_merged(pos, &state,
389-
&nr_checkouts);
389+
&nr_unmerged);
390390
pos = skip_same_name(ce, pos) - 1;
391391
}
392392
}
393393
errs |= finish_delayed_checkout(&state, &nr_checkouts);
394394

395395
if (opts->count_checkout_paths) {
396+
if (nr_unmerged)
397+
fprintf_ln(stderr, Q_("Recreated %d merge conflict",
398+
"Recreated %d merge conflicts",
399+
nr_unmerged),
400+
nr_unmerged);
396401
if (opts->source_tree)
397-
fprintf_ln(stderr, Q_("Checked out %d path out of %s",
398-
"Checked out %d paths out of %s",
402+
fprintf_ln(stderr, Q_("Updated %d path from %s",
403+
"Updated %d paths from %s",
399404
nr_checkouts),
400405
nr_checkouts,
401406
find_unique_abbrev(&opts->source_tree->object.oid,
402407
DEFAULT_ABBREV));
403-
else
404-
fprintf_ln(stderr, Q_("Checked out %d path out of the index",
405-
"Checked out %d paths out of the index",
408+
else if (!nr_unmerged || nr_checkouts)
409+
fprintf_ln(stderr, Q_("Updated %d path from the index",
410+
"Updated %d paths from the index",
406411
nr_checkouts),
407412
nr_checkouts);
408413
}

0 commit comments

Comments
 (0)