git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Peter Baumann <waste.manager@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	David Barr <david.barr@cordelta.com>
Subject: Re: [PATCH v4] fast-import: treat filemodify with empty tree as delete
Date: Fri, 28 Jan 2011 11:13:59 -0600	[thread overview]
Message-ID: <20110128171359.GA26930@burratino> (raw)
In-Reply-To: <20110127204649.GB19378@m62s10.vlinux.de>

Peter Baumann wrote:
> On Thu, Jan 27, 2011 at 01:48:45PM -0600, Jonathan Nieder wrote:
>>> On Thu, Jan 27, 2011 at 12:07:49AM -0600, Jonathan Nieder wrote:

>>>> +	 empty_tree=$(git mktree </dev/null) &&
[...]
>>                               unless we hardcode the object name
>> (which I prefer not to do).
>
> Wny not? It *is* already hardcoded in the GIT source code (see
> grep -a1 EMPTY cache.h output).

I think it is okay for the git implementation to rely on an
implementation detail. ;-)  Likewise, t0000 checks that the empty tree
has id 4b825dc6.  Meanwhile I would like to see people's scripts
and other tests using the $(git mktree </dev/null) form, since it is
more self-explanatory and avoids hardcoding an implementation detail.

Of course this is not an absolute thing.

Hope that helps,
Jonathan

Further reading: t0000-basic.h --help:

	Note that this test *deliberately* hard-codes many expected object
	IDs.  When object ID computation changes, like in the previous case of
	swapping compression and hashing order, the person who is making the
	modification *should* take notice and update the test vectors here.

"Tips for Writing Tests" in t/README:

	However, other tests that simply rely on basic parts of the core
	GIT working properly should not have that level of intimate
	knowledge of the core GIT internals.  If all the test scripts
	hardcoded the object IDs like t0000-basic.sh does, that defeats
	the purpose of t0000-basic.sh, which is to isolate that level of
	validation in one place.  Your test also ends up needing
	updating when such a change to the internal happens, so do _not_
	do it and leave the low level of validation to t0000-basic.sh.

  parent reply	other threads:[~2011-01-28 17:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 10:40 [PATCH/RFC] fast-import: add 'ls' command David Barr
2010-12-02 10:40 ` [PATCH] " David Barr
2010-12-02 12:37   ` Sverre Rabbelier
2010-12-02 12:57     ` David Michael Barr
2010-12-02 17:37     ` Jonathan Nieder
2010-12-02 19:20       ` Junio C Hamano
2010-12-02 22:51         ` David Barr
2011-01-03  8:01 ` [PATCH/RFC v2 0/3] " Jonathan Nieder
2011-01-03  8:22   ` [PATCH 1/3] fast-import: clarify handling of cat-blob feature Jonathan Nieder
2011-01-03  8:24   ` [PATCH 2/3] fast-import: treat filemodify with empty tree as delete Jonathan Nieder
2011-01-26 22:41     ` [PATCH v2] " Jonathan Nieder
2011-01-26 22:45       ` Sverre Rabbelier
2011-01-26 23:06         ` [PATCH jn/fast-import-fix v3] " Jonathan Nieder
2011-01-27  0:04           ` Junio C Hamano
2011-01-27  0:26             ` Jonathan Nieder
2011-01-27  6:07             ` [PATCH v4] " Jonathan Nieder
2011-01-27 19:33               ` Peter Baumann
2011-01-27 19:48                 ` Jonathan Nieder
2011-01-27 20:46                   ` Peter Baumann
2011-01-27 20:48                     ` Peter Baumann
2011-01-28 17:13                     ` Jonathan Nieder [this message]
2011-01-03  8:37   ` [PATCH 3/3] fast-import: add 'ls' command Jonathan Nieder
2011-01-26 21:39   ` [RFC] fast-import: 'cat-blob' and 'ls' commands Jonathan Nieder
2011-01-26 23:46     ` Sam Vilain

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=20110128171359.GA26930@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.org \
    --cc=srabbelier@gmail.com \
    --cc=waste.manager@gmx.de \
    /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).