From 9c5f3ee3b3a04182cc22630e9eb9fad95bd57fd7 Mon Sep 17 00:00:00 2001 From: Ævar Arnfjörð Bjarmason Date: Sat, 19 Nov 2022 14:07:31 +0100 Subject: read-cache API & users: make discard_index() return void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The discard_index() function has not returned non-zero since 7a51ed66f65 (Make on-disk index representation separate from in-core one, 2008-01-14), but we've had various code in-tree still acting as though that might be the case. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- sequencer.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'sequencer.c') diff --git a/sequencer.c b/sequencer.c index a46f3ad2e3..746a71cdc9 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3564,7 +3564,8 @@ static int do_exec(struct repository *r, const char *command_line) status = run_command(&cmd); /* force re-reading of the cache */ - if (discard_index(r->index) < 0 || repo_read_index(r) < 0) + discard_index(r->index); + if (repo_read_index(r) < 0) return error(_("could not read index")); dirty = require_clean_work_tree(r, "rebase", NULL, 1, 1); @@ -4029,9 +4030,11 @@ static int do_merge(struct repository *r, ret = run_command(&cmd); /* force re-reading of the cache */ - if (!ret && (discard_index(r->index) < 0 || - repo_read_index(r) < 0)) - ret = error(_("could not read index")); + if (!ret) { + discard_index(r->index); + if (repo_read_index(r) < 0) + ret = error(_("could not read index")); + } goto leave_merge; } @@ -4404,8 +4407,8 @@ void create_autostash(struct repository *r, const char *path) printf(_("Created autostash: %s\n"), buf.buf); if (reset_head(r, &ropts) < 0) die(_("could not reset --hard")); - if (discard_index(r->index) < 0 || - repo_read_index(r) < 0) + discard_index(r->index); + if (repo_read_index(r) < 0) die(_("could not read index")); } strbuf_release(&buf); -- cgit v1.3-6-g1900