From: Junio C Hamano <gitster@pobox.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: David Turner <dturner@twopensource.com>,
git@vger.kernel.org, David Turner <dturner@twitter.com>
Subject: Re: [PATCH v9 1/4] cache-tree: Create/update cache-tree on checkout
Date: Tue, 15 Jul 2014 14:55:50 -0700 [thread overview]
Message-ID: <xmqqr41mthg9.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <53C5828F.2050005@web.de> ("Torsten Bögershausen"'s message of "Tue, 15 Jul 2014 21:35:43 +0200")
Torsten Bögershausen <tboegi@web.de> writes:
> On 07/13/2014 10:28 PM, David Turner wrote:
>> From: David Turner <dturner@twopensource.com>
> []
>> diff --git a/cache-tree.c b/cache-tree.c
>> index 7fa524a..f951d7d 100644
>> --- a/cache-tree.c
>> +++ b/cache-tree.c
>> @@ -239,9 +239,12 @@ static int update_one(struct cache_tree *it,
>> struct strbuf buffer;
>> int missing_ok = flags & WRITE_TREE_MISSING_OK;
>> int dryrun = flags & WRITE_TREE_DRY_RUN;
>> + int repair = flags & WRITE_TREE_REPAIR;
>> int to_invalidate = 0;
>> int i;
>> + assert(!(dryrun && repair));
> I think something in the spirit of
> die("dryrun and repaiir can not be used together"\n)
> Would be nicer to the user as well as being more reliable (as assert
> may be a no-op in some systems)
While it is a good suggestion *not* to attempt validating the
end-user input with assert() for the reason you state, I think for
this particular case, these flags only come from the code and assert()
to catch programming errors would be sufficient.
Besides, as discussed elsewhere, WRITE_TREE_DRY_RUN should not be
used, and the support for it should be dropped. It is broken in
that the code path that leads to update_one() may correctly compute
tree object names and stuff them in the cache-tree, higher layer
code would then complain on such a cache-tree that records tree
objects that do not exist.
prev parent reply other threads:[~2014-07-15 21:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-13 20:28 [PATCH v9 1/4] cache-tree: Create/update cache-tree on checkout David Turner
2014-07-13 20:28 ` [PATCH v9 2/4] test-dump-cache-tree: invalid trees are not errors David Turner
2014-07-13 20:28 ` [PATCH v9 3/4] cache-tree: subdirectory tests David Turner
2014-07-13 20:28 ` [PATCH v9 4/4] cache-tree: Write updated cache-tree after commit David Turner
2014-07-15 19:35 ` [PATCH v9 1/4] cache-tree: Create/update cache-tree on checkout Torsten Bögershausen
2014-07-15 21:55 ` Junio C Hamano [this message]
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=xmqqr41mthg9.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=dturner@twitter.com \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=tboegi@web.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 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.