Merge branch 'ma/skip-writing-unchanged-index'
Internal API clean-up to allow write_locked_index() optionally skip writing the in-core index when it is not modified. * ma/skip-writing-unchanged-index: write_locked_index(): add flag to avoid writing unchanged index
This commit is contained in:
@ -652,10 +652,9 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
|
||||
|
||||
hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
|
||||
refresh_cache(REFRESH_QUIET);
|
||||
if (active_cache_changed &&
|
||||
write_locked_index(&the_index, &lock, COMMIT_LOCK))
|
||||
if (write_locked_index(&the_index, &lock,
|
||||
COMMIT_LOCK | SKIP_IF_UNCHANGED))
|
||||
return error(_("Unable to write index."));
|
||||
rollback_lock_file(&lock);
|
||||
|
||||
if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree")) {
|
||||
int clean, x;
|
||||
@ -692,10 +691,9 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
|
||||
remoteheads->item, reversed, &result);
|
||||
if (clean < 0)
|
||||
exit(128);
|
||||
if (active_cache_changed &&
|
||||
write_locked_index(&the_index, &lock, COMMIT_LOCK))
|
||||
if (write_locked_index(&the_index, &lock,
|
||||
COMMIT_LOCK | SKIP_IF_UNCHANGED))
|
||||
die (_("unable to write %s"), get_index_file());
|
||||
rollback_lock_file(&lock);
|
||||
return clean ? 0 : 1;
|
||||
} else {
|
||||
return try_merge_command(strategy, xopts_nr, xopts,
|
||||
@ -811,10 +809,9 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
|
||||
|
||||
hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
|
||||
refresh_cache(REFRESH_QUIET);
|
||||
if (active_cache_changed &&
|
||||
write_locked_index(&the_index, &lock, COMMIT_LOCK))
|
||||
if (write_locked_index(&the_index, &lock,
|
||||
COMMIT_LOCK | SKIP_IF_UNCHANGED))
|
||||
return error(_("Unable to write index."));
|
||||
rollback_lock_file(&lock);
|
||||
|
||||
write_tree_trivial(&result_tree);
|
||||
printf(_("Wonderful.\n"));
|
||||
|
Reference in New Issue
Block a user