git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Johan Herland <johan@herland.net>,
	stefan.naewe@atlas-elektronik.com
Subject: Re: [RFC] notes: avoid recommitting identical trees
Date: Tue, 31 Aug 2010 20:45:22 +0200	[thread overview]
Message-ID: <4C7D4DC2.4070008@drmicha.warpmail.net> (raw)
In-Reply-To: <20100831182931.GA21489@sigill.intra.peff.net>

Jeff King venit, vidit, dixit 31.08.2010 20:29:
> On Tue, Aug 31, 2010 at 08:26:34PM +0200, Michael J Gruber wrote:
> 
>> Junio C Hamano venit, vidit, dixit 31.08.2010 18:44:
>>> Michael J Gruber <git@drmicha.warpmail.net> writes:
>>>
>>>>>> +	if (!parent || parse_commit(parent->item) || parse_tree(parent->item->tree) ||
>>>>>> +		hashcmp(parent->item->tree->object.sha1, tree_sha1)) {
>>>>>
>>>>> I didn't check, but I can imagine you can drop the parse_tree here. We
>>>>> should know the object sha1 once the commit is parsed.
>>>>
>>>> parse_commit() does a lookup_tree() but I don't think that it parses the
>>>> tree, i.e. I don't hink it fills in tree->object.sha1.
>>>
>>> Huh?  parse_tree(tree) calls read_sha1_file(tree->object.sha1) to parse
>>> the tree.  How can it do without filling tree->object.sha1?
>>>
>>
>> Sure parse_tree() does that. That's why I call it. I never claimed it
>> doesn't.
> 
> I think the claim is that it is already parsed. Look at parse_tree. The
> first non-declaration lines are:
> 
>   if (item->object.parsed)
>           return 0;
>   buffer = read_sha1_file(item->object.sha1, &type, &size);
> 
> So _somebody_ has already filled in item->object.sha1.
> 
> -Peff

OK, now I understand Junio's answer...
...and I also see where lookup_tree() fills the sha1, which I failed to
see before.

I guess what happened was that I had the parse_tree without
parse_commit, which segfaulted, and then inserted parse_commit.

In any case, it seems Johan is going with his approach, so you can
forget about the RFC, be it with or without parse_tree.

Michael

  reply	other threads:[~2010-08-31 18:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31  8:09 Q. about usage of notes Stefan Naewe
2010-08-31  9:07 ` Johan Herland
2010-08-31 10:13   ` Stefan Naewe
2010-08-31 10:15     ` Stefan Naewe
2010-08-31 15:16       ` [RFC] notes: avoid recommitting identical trees Michael J Gruber
2010-08-31 16:01         ` Jeff King
2010-08-31 16:15           ` Michael J Gruber
2010-08-31 16:44             ` Junio C Hamano
2010-08-31 18:26               ` Michael J Gruber
2010-08-31 18:29                 ` Jeff King
2010-08-31 18:45                   ` Michael J Gruber [this message]
2010-08-31 18:43                 ` Junio C Hamano
2010-08-31 16:08         ` Johan Herland
2010-08-31 15:53     ` Q. about usage of notes Johan Herland
2010-08-31 15:56       ` [PATCH 1/2] notes: Don't create (empty) commit when removing non-existing notes Johan Herland
2010-08-31 15:59       ` [PATCH 2/2] notes.h: Extend remove_note to return the SHA1 of the removed note, if any Johan Herland

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=4C7D4DC2.4070008@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johan@herland.net \
    --cc=peff@peff.net \
    --cc=stefan.naewe@atlas-elektronik.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).