rerere: report autoupdated paths only after actually updating them
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 28, 2015 at 21:13 UTC
a14c7ab8f58f3b2aea99e65a74c9f9ab4f955a40
1 file changed
+12
-10
rerere.c
+12
-10
@@ -482,6 +482,8 @@ static void update_paths(struct string_list *update)
482
struct string_list_item *item = &update->items[i];
483
if (add_file_to_cache(item->string, 0))
484
exit(128);
485
+ fprintf(stderr, "Staged '%s' using previous resolution.\n",
486
+ item->string);
487
}
488
489
if (active_cache_changed) {
@@ -536,16 +538,16 @@ static int do_plain_rerere(struct string_list *rr, int fd)
538
const char *name = (const char *)rr->items[i].util;
539
540
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;
551
}
552
553
/* Let's see if we have resolved it. */