remerge-diff: lazily prepare temporary objdir on demand

It is error prone for each caller that sets revs.remerge_diff bit
to be responsible for preparing a temporary object directory and
rotate it into the list of alternate object stores, making it the
primary object store.

Instead, remove the code to set up and arrange the temporary object
directory from the current callers and implement it in the code that
runs remerge-diff logic.  The code to undo the futzing of the list
of alternate object store is still spread across the callers, but we
will deal with it in future steps.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2024-08-09 15:30:51 -07:00
parent a77554ea09
commit 245cac5c33
3 changed files with 12 additions and 18 deletions

View File

@ -168,13 +168,6 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
opt->diffopt.rotate_to_strict = 1;
if (opt->remerge_diff) {
opt->remerge_objdir = tmp_objdir_create("remerge-diff");
if (!opt->remerge_objdir)
die(_("unable to create temporary object directory"));
tmp_objdir_replace_primary_odb(opt->remerge_objdir, 1);
}
/*
* NOTE! We expect "a..b" to expand to "^a b" but it is
* perfectly valid for revision range parser to yield "b ^a",