Re: [PATCH v2] diff-tree: fix crash when used with --remerge-diff
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 9, 2024, 15:46 UTC
- Message-ID
- <xmqqy155em2n.fsf@gitster.g>
- In-Reply-To
- <xmqq5xs9g19w.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> but I have to wonder if we do even better in a future follow-up > patch.
"if we do" -> "if we can do".
Show 7 quoted lines
> So wouldn't it work well if we > > (1) at the beginning of do_remerge_diff(), only once for a rev_info > structure: > (1-a) lazily do the "object directory rotation" > (1-b) set up an atexit handler to clear the temporary object > store
An atexit handler may not be enough, when a program wants to start creating a real object after we did a remerge-diff but before exiting. So we'd probably need to allow an explicit "ok, we are done" clean-up call for such a program, too.
And the atexit handler can call the same clean-up function if the program hasn't called it explicitly. For logically read-only operations like diff-tree, they do not have to worry about rotating the real object store back to the primary status as soon as possible.