Skip to content

Commit 74419c2

Browse files
committed
Merge branch 'jn/rerere-fail-on-auto-update-failure' into maint
"git rerere" (invoked internally from many mergy operations) did not correctly signal errors when told to update the working tree files and failed to do so for whatever reason. * jn/rerere-fail-on-auto-update-failure: rerere: error out on autoupdate failure
2 parents faf723a + 89ea903 commit 74419c2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

rerere.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,27 +477,23 @@ static int merge(const char *name, const char *path)
477477

478478
static struct lock_file index_lock;
479479

480-
static int update_paths(struct string_list *update)
480+
static void update_paths(struct string_list *update)
481481
{
482482
int i;
483-
int fd = hold_locked_index(&index_lock, 0);
484-
int status = 0;
485483

486-
if (fd < 0)
487-
return -1;
484+
hold_locked_index(&index_lock, 1);
488485

489486
for (i = 0; i < update->nr; i++) {
490487
struct string_list_item *item = &update->items[i];
491-
if (add_file_to_cache(item->string, ADD_CACHE_IGNORE_ERRORS))
492-
status = -1;
488+
if (add_file_to_cache(item->string, 0))
489+
exit(128);
493490
}
494491

495-
if (!status && active_cache_changed) {
492+
if (active_cache_changed) {
496493
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
497494
die("Unable to write new index file");
498-
} else if (fd >= 0)
495+
} else
499496
rollback_lock_file(&index_lock);
500-
return status;
501497
}
502498

503499
static int do_plain_rerere(struct string_list *rr, int fd)

0 commit comments

Comments
 (0)