summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-21 18:30:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-21 18:30:10 (GMT)
commitbeb2cdf5041104a7513301a9b20944a617eec94e (patch)
tree6f44e7c048bc9857025235064b956a5d1d53ee25 /sequencer.c
parent75901dfd52ef97df51621a23156db96c9cd4a90b (diff)
parent610008146ed1647bb1da6a098e314b8929ff213e (diff)
downloadgit-beb2cdf5041104a7513301a9b20944a617eec94e.zip
git-beb2cdf5041104a7513301a9b20944a617eec94e.tar.gz
git-beb2cdf5041104a7513301a9b20944a617eec94e.tar.bz2
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
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sequencer.c b/sequencer.c
index 091bd6b..f9d1001 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -517,15 +517,14 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
return clean;
}
- if (active_cache_changed &&
- write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
+ if (write_locked_index(&the_index, &index_lock,
+ COMMIT_LOCK | SKIP_IF_UNCHANGED))
/*
* TRANSLATORS: %s will be "revert", "cherry-pick" or
* "rebase -i".
*/
return error(_("%s: Unable to write new index file"),
_(action_name(opts)));
- rollback_lock_file(&index_lock);
if (!clean)
append_conflicts_hint(msgbuf);
@@ -1713,13 +1712,13 @@ static int read_and_refresh_cache(struct replay_opts *opts)
_(action_name(opts)));
}
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
- if (the_index.cache_changed && index_fd >= 0) {
- if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK)) {
+ if (index_fd >= 0) {
+ if (write_locked_index(&the_index, &index_lock,
+ COMMIT_LOCK | SKIP_IF_UNCHANGED)) {
return error(_("git %s: failed to refresh the index"),
_(action_name(opts)));
}
}
- rollback_lock_file(&index_lock);
return 0;
}