git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: 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 12:01:45 -0400	[thread overview]
Message-ID: <20100831160145.GC11014@sigill.intra.peff.net> (raw)
In-Reply-To: <bc44b3393db4018487bb956d00a12fa73f04ca9e.1283267564.git.git@drmicha.warpmail.net>

On Tue, Aug 31, 2010 at 05:16:17PM +0200, Michael J Gruber wrote:

> Currently, "git notes" behaves like "git commit --allow-empty" when
> committing notes trees. In particular, removing nonexisting notes leads
> to empty commits "commits with no diff".
> 
> Change this to avoid unnecessary notes commits.

Is this a sufficient check in the case of notes? Is it possible that we
re-balanced the fanout of the notes tree and got a different tree sha1,
even though there is nothing interesting to commit?

> +	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.

-Peff

  reply	other threads:[~2010-08-31 16:01 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 [this message]
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
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=20100831160145.GC11014@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.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).