From: Jonathan Nieder <jrnieder@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, "Jens Lehmann" <Jens.Lehmann@web.de>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH 01/10] add: do not rely on dtype being NULL behavior
Date: Mon, 15 Nov 2010 06:14:15 -0600 [thread overview]
Message-ID: <20101115121415.GB14729@burratino> (raw)
In-Reply-To: <1289817410-32470-2-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy wrote:
> Commit c84de70 (excluded_1(): support exclude files in index -
> 2009-08-20) added support for excluded() where dtype can be NULL. It
> was designed specifically for index matching because there was no
> other way to extract dtype information from index. It did not support
> wildcard matching (for example, "a*/" pattern would fail to match).
>
> The code was probably misread when commit 108da0d (git add: Add the
> "--ignore-missing" option for the dry run - 2010-07-10) was made
> because DT_UNKNOWN happens to be zero (NULL) too.
>
> Do not pass DT_UNKNOWN/NULL to excluded(), instead pass a pointer to a
> variable that contains DT_UNKNOWN. The real dtype will be extracted
> from worktree by excluded(), as expected.
Could you rephrase this in a way that contrasts current and desired
behavior? Is it like this?
The "git add --ignore-missing --dry-run" codepath is
interpreting .gitignore incorrectly, unlike "git add". For
example:
$ test -e foo || echo missing
missing
$ echo foo/ >>.gitignore
$ mkdir bar
$ git add --ignore-missing --dry-run foo; echo $?
The following paths are ignored by one of your .gitignore files:
foo/
Use -f if you really want to add them.
fatal: no files added
128
$ git add --ignore-missing --dry-run bar/foo; echo $?
0
In the original use case (preparing to add a submodule) the
behavior of the first command is correct, second incorrect.
If the entry to be added was a regular file, it would be the
other way around.
The cause: the --ignore-missing code passes DT_UNKNOWN as the
dtype_ptr argument to excluded() which happens to equal zero
(NULL) and accidentally triggers the "match pathspecs in index
only" codepath (see c84de70, excluded_1(): support exclude
files in index, 2009-08-20) that is unfortunately a bit
primitive.
Surely what was really wanted is to check paths against the
index and work tree, defaulting to "regular file".
Wait --- that's not true. In the "git submodule add" case, we really
want to default to (or even better, force) "directory".
next prev parent reply other threads:[~2010-11-15 12:14 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-15 10:36 [PATCH 00/10] Sparse checkout fixes and improvements Nguyễn Thái Ngọc Duy
2010-11-15 10:36 ` [PATCH 01/10] add: do not rely on dtype being NULL behavior Nguyễn Thái Ngọc Duy
2010-11-15 12:14 ` Jonathan Nieder [this message]
2010-11-16 2:18 ` Nguyen Thai Ngoc Duy
2010-11-16 2:42 ` Jonathan Nieder
2010-11-16 18:58 ` Junio C Hamano
2010-11-17 6:38 ` Nguyen Thai Ngoc Duy
2010-11-15 10:36 ` [PATCH 02/10] unpack-trees: move all skip-worktree check back to unpack_trees() Nguyễn Thái Ngọc Duy
2010-11-15 12:34 ` Thiago Farina
2010-11-16 2:19 ` Nguyen Thai Ngoc Duy
2010-11-15 16:01 ` Jonathan Nieder
2010-11-16 2:39 ` Nguyen Thai Ngoc Duy
2010-11-15 10:36 ` [PATCH 03/10] unpack-trees: add function to update ce_flags based on sparse patterns Nguyễn Thái Ngọc Duy
2010-11-15 18:30 ` Jonathan Nieder
2010-11-15 20:19 ` Jonathan Nieder
2010-11-15 10:36 ` [PATCH 04/10] unpack-trees: fix sparse checkout's "unable to match directories" fault Nguyễn Thái Ngọc Duy
2010-11-15 19:10 ` Jonathan Nieder
2010-11-16 2:43 ` Nguyen Thai Ngoc Duy
2010-11-15 10:36 ` [PATCH 05/10] unpack-trees: optimize full checkout case Nguyễn Thái Ngọc Duy
2010-11-15 20:41 ` Jonathan Nieder
2010-11-15 10:36 ` [PATCH 06/10] templates: add info/sparse-checkout Nguyễn Thái Ngọc Duy
2010-11-15 10:36 ` [PATCH 07/10] checkout: add -S to update sparse checkout Nguyễn Thái Ngọc Duy
2010-11-15 21:16 ` Jonathan Nieder
2010-11-15 21:52 ` Miles Bader
2010-11-17 15:02 ` Nguyen Thai Ngoc Duy
2010-11-16 3:08 ` Nguyen Thai Ngoc Duy
2010-11-15 10:36 ` [PATCH 08/10] checkout: add --full to fully populate working directory Nguyễn Thái Ngọc Duy
2010-11-15 21:23 ` Jonathan Nieder
2010-11-16 2:50 ` Nguyen Thai Ngoc Duy
2010-11-15 10:36 ` [PATCH 09/10] git-checkout.txt: mention of sparse checkout Nguyễn Thái Ngọc Duy
2010-11-15 10:36 ` [PATCH 10/10] clean: support cleaning sparse checkout with -S Nguyễn Thái Ngọc Duy
2010-11-15 21:30 ` Jonathan Nieder
2010-11-16 2:53 ` Nguyen Thai Ngoc Duy
2010-11-16 3:07 ` Jonathan Nieder
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=20101115121415.GB14729@burratino \
--to=jrnieder@gmail.com \
--cc=Jens.Lehmann@web.de \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.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 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.