From: Jeff King <peff@peff.net>
To: David Turner <dturner@twopensource.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
git mailing list <git@vger.kernel.org>
Subject: Re: mktree: multiple same-named objects
Date: Wed, 27 Aug 2014 01:13:41 -0400 [thread overview]
Message-ID: <20140827051341.GB32141@peff.net> (raw)
In-Reply-To: <1409114517.13351.6.camel@leckie>
On Wed, Aug 27, 2014 at 12:41:57AM -0400, David Turner wrote:
> git mktree seems to allow the creation of a tree object with multiple
> objects of the same name but different SHAs.
Yeah, I don't think we do many quality checks there. Ditto for "git
hash-object".
The latter goes through index_mem, which at least checks that the
resulting tree is parseable. It does not look like mktree even checks
that.
> Summary: git mktree ought to forbid this, and possibly there ought to be
> other checks (for instance, when unpacking) to prevent this.
The checks in git-fsck will notice your problem (and many others). I
think we should be running them anytime we create an object based on
arbitrary data (including mktree and hash-object). Code paths like "git
write-tree" and "git commit-tree" are probably OK, as their code should
follow the standard (it would not hurt to double-check their output,
though there may be a performance implication).
Dscho (cc'd) has been looking into this approach; I don't know how far
he has gotten.
-Peff
next prev parent reply other threads:[~2014-08-27 5:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 4:41 mktree: multiple same-named objects David Turner
2014-08-27 5:01 ` Duy Nguyen
2014-08-27 21:48 ` David Turner
2014-08-27 5:13 ` Jeff King [this message]
2014-08-27 15:17 ` Junio C Hamano
2014-08-27 16:24 ` Jeff King
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=20140827051341.GB32141@peff.net \
--to=peff@peff.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.