Message ID | c615a61d32644b64ef8f47feb47ec909286c56b3.1699381371.git.me@ttaylorr.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | replay: implement support for writing new objects to a pack | expand |
On Tue, Nov 7, 2023 at 10:22 AM Taylor Blau <me@ttaylorr.com> wrote: > > In a previous commit, the ORT merge backend learned how to use the > bulk-checkin mechanism to emit a single pack containing any new objects > created during the merge. This functionality was implemented by setting > up a new ODB transaction, and finalizing it at the end of the merge via > `process_entries()`. > > In a future commit, we will extend this functionality to the new `git > replay` command, which needs to see objects from previous steps in order > to replay each commit. > > As a step towards implementing this, teach the ORT backend to flush the > ODB transaction at the end of each step in `process_entries()`, and then > finalize the result with `end_odb_transaction()` when calling > `merge_finalize()`. process_entries() contains a for loop inside it, so "end of each step in `process_entries()`" sounds like you are flushing after entry, i.e. several times per commit being replayed. Perhaps "at the end of `process_entries()` (thus creating one pack per commit)" ? (Of course, the fact that we need this change earlier, in the other series, kinda makes this point moot. Just thought I'd mention it anyway in case it comes back up in your restructuring.)
diff --git a/merge-ort.c b/merge-ort.c index 523577d71e..7b352451cc 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -4354,7 +4354,7 @@ static int process_entries(struct merge_options *opt, ret = -1; if (opt->write_pack) - end_odb_transaction(); + flush_odb_transaction(); cleanup: string_list_clear(&plist, 0); @@ -4726,6 +4726,9 @@ void merge_switch_to_result(struct merge_options *opt, void merge_finalize(struct merge_options *opt, struct merge_result *result) { + if (opt->write_pack) + end_odb_transaction(); + if (opt->renormalize) git_attr_set_direction(GIT_ATTR_CHECKIN); assert(opt->priv == NULL);
In a previous commit, the ORT merge backend learned how to use the bulk-checkin mechanism to emit a single pack containing any new objects created during the merge. This functionality was implemented by setting up a new ODB transaction, and finalizing it at the end of the merge via `process_entries()`. In a future commit, we will extend this functionality to the new `git replay` command, which needs to see objects from previous steps in order to replay each commit. As a step towards implementing this, teach the ORT backend to flush the ODB transaction at the end of each step in `process_entries()`, and then finalize the result with `end_odb_transaction()` when calling `merge_finalize()`. For normal `merge-tree --write-pack` invocations, this produces no functional change: the pack is written out at the end of `process_entries()`, and then the `end_odb_transaction()` call is a noop. Signed-off-by: Taylor Blau <me@ttaylorr.com> --- merge-ort.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)