diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-10-07 11:32:53 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 11:32:53 +0900 |
commit | ba2d45112224a0bd5ba0f10ba180c88d148cec36 (patch) | |
tree | c4824e0fa57f40c49904807f9913aa4c2160b6bb /builtin/am.c | |
parent | Fifth batch (diff) | |
parent | stash: make sure to write refreshed cache (diff) | |
download | tgif-ba2d45112224a0bd5ba0f10ba180c88d148cec36.tar.xz |
Merge branch 'tg/stash-refresh-index'
"git stash" learned to write refreshed index back to disk.
* tg/stash-refresh-index:
stash: make sure to write refreshed cache
merge: use refresh_and_write_cache
factor out refresh_and_write_cache function
Diffstat (limited to 'builtin/am.c')
-rw-r--r-- | builtin/am.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/builtin/am.c b/builtin/am.c index ee7305eaa6..39a70fc79a 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1072,19 +1072,6 @@ static const char *msgnum(const struct am_state *state) } /** - * Refresh and write index. - */ -static void refresh_and_write_cache(void) -{ - struct lock_file lock_file = LOCK_INIT; - - hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR); - refresh_cache(REFRESH_QUIET); - if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) - die(_("unable to write index file")); -} - -/** * Dies with a user-friendly message on how to proceed after resolving the * problem. This message can be overridden with state->resolvemsg. */ @@ -1705,7 +1692,8 @@ static void am_run(struct am_state *state, int resume) unlink(am_path(state, "dirtyindex")); - refresh_and_write_cache(); + if (refresh_and_write_cache(REFRESH_QUIET, 0, 0) < 0) + die(_("unable to write index file")); if (repo_index_has_changes(the_repository, NULL, &sb)) { write_state_bool(state, "dirtyindex", 1); |