From: Junio C Hamano <gitster@pobox.com>
To: "blanet via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>,
blanet <bupt_xingxin@163.com>,
Xing Xin <xingxin.xx@bytedance.com>
Subject: Re: [PATCH v2] diff-tree: fix crash when used with --remerge-diff
Date: Fri, 09 Aug 2024 08:32:27 -0700 [thread overview]
Message-ID: <xmqq5xs9g19w.fsf@gitster.g> (raw)
In-Reply-To: <pull.1771.v2.git.1723188292498.gitgitgadget@gmail.com> (blanet via GitGitGadget's message of "Fri, 09 Aug 2024 07:24:52 +0000")
"blanet via GitGitGadget" <gitgitgadget@gmail.com> writes:
> Elijah Newren, the author of the remerge diff feature, notes that other
> callers of `log-tree.c:log_tree_commit` (the only caller of
> `log-tree.c:do_remerge_diff`) also exist, but:
>
> `builtin/am.c`: manually sets all flags; remerge_diff is not among them
> `sequencer.c`: manually sets all flags; remerge_diff is not among them
>
> so `builtin/diff-tree.c` really is the only caller that was overlooked
> when remerge-diff functionality was added.
That is more than OK as a band-aid, and I'll take the patch as-is,
but I have to wonder if we do even better in a future follow-up
patch.
Any time do_remerge_diff() is entered, we know that either the end
user (from the command line) or the hard-coded caller (like
am/sequencer cited above) wants us to do the remerge-diff, which in
turn requires us to have the temporary object directory rotated into
the status of the primary object store. And there is nothing in
that object directory rotation code that requires caller-specific
customization---it is the same "create remerge-diff directory as
tmp-objdir, rotate it into the alt object store chain as the
primary" regardless of the actual caller).
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
(2) remove all the "ah, we need to prepare and tear down the
temporary object store for _this_ operation" we have sprinkled
in different code paths (including the one added by the fix we
are looking at).
That way, we won't have to worry about adding future remerge_diff
users, including existing hard-coded callers.
ANyway, thanks for the fix. It is very pleasing to see contributors
working well together.
next prev parent reply other threads:[~2024-08-09 15:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 13:20 [PATCH] diff-tree: fix crash when used with --remerge-diff blanet via GitGitGadget
2024-08-08 16:03 ` Elijah Newren
2024-08-08 17:24 ` Junio C Hamano
2024-08-09 7:25 ` Xing Xin
2024-08-09 7:24 ` [PATCH v2] " blanet via GitGitGadget
2024-08-09 15:32 ` Junio C Hamano [this message]
2024-08-09 15:46 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5xs9g19w.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=bupt_xingxin@163.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
--cc=xingxin.xx@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).