From: Jeff King <peff@peff.net>
To: Kirill Smelkov <kirr@mns.spb.ru>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 4/4] revision: convert to using diff_tree_sha1()
Date: Wed, 5 Feb 2014 12:25:11 -0500 [thread overview]
Message-ID: <20140205172511.GA7268@sigill.intra.peff.net> (raw)
In-Reply-To: <975fbde9bdd2c5aad7376e398ca8001b9a41d2d6.1391619218.git.kirr@mns.spb.ru>
On Wed, Feb 05, 2014 at 08:57:12PM +0400, Kirill Smelkov wrote:
> Since diff_tree_sha1() can now accept empty trees via NULL sha1, we
> could just call it without manually reading trees into tree_desc and
> duplicating code.
>
> Besides, that
>
> if (!tree)
> return 0;
>
> looked suspect - we were saying an invalid tree != empty tree, but maybe it is
> better to just say the tree is invalid here, which is what diff_tree_sha1()
> does for such case.
I think that is sensible. The assertion that "invalid != empty" is
probably sane, because we handle the empty tree as internal magic. But I
do not see any reason we should be hitting this code path regularly with
an invalid tree, short of repository corruption, so in practice I don't
think it matters.
This does introduce a die() where there was not one previously, and that
can make things harder to diagnose/debug in a corrupted repository. But
it looks like this is limited to the history-simplification code, and I
suspect that it is not commonly used in the case of corruption.
So I think the patch looks fine.
-Peff
next prev parent reply other threads:[~2014-02-05 17:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-05 16:57 [PATCH 0/4] Teach diff_tree_sha1() to accept NULL sha1 for empty trees Kirill Smelkov
2014-02-05 16:57 ` [PATCH 1/4] tree-diff: allow diff_tree_sha1 to accept NULL sha1 Kirill Smelkov
2014-02-05 16:57 ` [PATCH 2/4] tree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL Kirill Smelkov
2014-02-05 16:57 ` [PATCH 3/4] line-log: convert to using diff_tree_sha1() Kirill Smelkov
2014-02-06 21:01 ` Thomas Rast
2014-02-06 21:50 ` Junio C Hamano
2014-02-05 16:57 ` [PATCH 4/4] revision: " Kirill Smelkov
2014-02-05 17:25 ` Jeff King [this message]
2014-02-05 17:25 ` [PATCH 0/4] Teach diff_tree_sha1() to accept NULL sha1 for empty trees Jeff King
2014-02-05 18:52 ` 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=20140205172511.GA7268@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kirr@mns.spb.ru \
/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).