Skip to content

Commit a14c7ab

Browse files
committed
rerere: report autoupdated paths only after actually updating them
Signed-off-by: Junio C Hamano <[email protected]>
1 parent e2cb6a9 commit a14c7ab

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

rerere.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ static void update_paths(struct string_list *update)
482482
struct string_list_item *item = &update->items[i];
483483
if (add_file_to_cache(item->string, 0))
484484
exit(128);
485+
fprintf(stderr, "Staged '%s' using previous resolution.\n",
486+
item->string);
485487
}
486488

487489
if (active_cache_changed) {
@@ -536,16 +538,16 @@ static int do_plain_rerere(struct string_list *rr, int fd)
536538
const char *name = (const char *)rr->items[i].util;
537539

538540
if (has_rerere_resolution(name)) {
539-
if (!merge(name, path)) {
540-
const char *msg;
541-
if (rerere_autoupdate) {
542-
string_list_insert(&update, path);
543-
msg = "Staged '%s' using previous resolution.\n";
544-
} else
545-
msg = "Resolved '%s' using previous resolution.\n";
546-
fprintf(stderr, msg, path);
547-
goto mark_resolved;
548-
}
541+
if (merge(name, path))
542+
continue;
543+
544+
if (rerere_autoupdate)
545+
string_list_insert(&update, path);
546+
else
547+
fprintf(stderr,
548+
"Resolved '%s' using previous resolution.\n",
549+
path);
550+
goto mark_resolved;
549551
}
550552

551553
/* Let's see if we have resolved it. */

0 commit comments

Comments
 (0)