* t7061: comments and one failure
@ 2013-01-05 11:07 Torsten Bögershausen
2013-01-05 11:24 ` Jeff King
0 siblings, 1 reply; 13+ messages in thread
From: Torsten Bögershausen @ 2013-01-05 11:07 UTC (permalink / raw)
To: apelisse, Git Mailing List; +Cc: Torsten Bögershausen
Hej,
TC 9 is failing (Mac OS X 10.6),
==========================
expecting success:
>tracked/uncommitted &&
git status --porcelain --ignored >actual &&
test_cmp expected actual
--- expected 2013-01-05 11:01:00.000000000 +0000
+++ actual 2013-01-05 11:01:00.000000000 +0000
@@ -1,4 +1,3 @@
?? .gitignore
?? actual
?? expected
-!! tracked/
not ok 9 - status ignored tracked directory and uncommitted file with --ignore
#
# >tracked/uncommitted &&
# git status --porcelain --ignored >actual &&
# test_cmp expected actual
#
=======================
I haven't been able to dig further into this,
(I can volonteer to do some more debugging).
Looking into the code, there are 2 questions:
1) echo "ignored" >.gitignore &&
We don't need the quoting of a simple string which does not have space in it.
2) : >untracked/ignored &&
Do we need the colon here?
Would it make sence to do the following:
diff --git a/t/t7061-wtstatus-ignore.sh b/t/t7061-wtstatus-ignore.sh
index 0da1214..761a2e7 100755
--- a/t/t7061-wtstatus-ignore.sh
+++ b/t/t7061-wtstatus-ignore.sh
@@ -12,10 +12,10 @@ cat >expected <<\EOF
EOF
test_expect_success 'status untracked directory with --ignored' '
- echo "ignored" >.gitignore &&
+ echo ignored >.gitignore &&
mkdir untracked &&
- : >untracked/ignored &&
- : >untracked/uncommitted &&
+ >untracked/ignored &&
+ >untracked/uncommitted &&
git status --porcelain --ignored >actual &&
test_cmp expected actual
'
@@ -43,7 +43,7 @@ EOF
test_expect_success 'status ignored directory with --ignore' '
rm -rf untracked &&
mkdir ignored &&
- : >ignored/uncommitted &&
+ >ignored/uncommitted &&
git status --porcelain --ignored >actual &&
test_cmp expected actual
'
@@ -71,8 +71,8 @@ test_expect_success 'status untracked directory with ignored files with --ignore
rm -rf ignored &&
mkdir untracked-ignored &&
mkdir untracked-ignored/test &&
- : >untracked-ignored/ignored &&
- : >untracked-ignored/test/ignored &&
+ >untracked-ignored/ignored &&
+ >untracked-ignored/test/ignored &&
git status --porcelain --ignored >actual &&
test_cmp expected actual
'
@@ -99,10 +99,10 @@ EOF
test_expect_success 'status ignored tracked directory with --ignore' '
rm -rf untracked-ignored &&
mkdir tracked &&
- : >tracked/committed &&
+ >tracked/committed &&
git add tracked/committed &&
git commit -m. &&
- echo "tracked" >.gitignore &&
+ echo tracked >.gitignore &&
git status --porcelain --ignored >actual &&
test_cmp expected actual
'
@@ -126,7 +126,7 @@ cat >expected <<\EOF
EOF
test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' '
- : >tracked/uncommitted &&
+ >tracked/uncommitted &&
git status --porcelain --ignored >actual &&
test_cmp expected actual
'
/Torsten
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: t7061: comments and one failure
2013-01-05 11:07 t7061: comments and one failure Torsten Bögershausen
@ 2013-01-05 11:24 ` Jeff King
2013-01-05 11:29 ` Antoine Pelisse
2013-01-05 20:42 ` [PATCH] status: report ignored yet tracked directories Antoine Pelisse
0 siblings, 2 replies; 13+ messages in thread
From: Jeff King @ 2013-01-05 11:24 UTC (permalink / raw)
To: Torsten Bögershausen; +Cc: apelisse, Git Mailing List
On Sat, Jan 05, 2013 at 12:07:24PM +0100, Torsten Bögershausen wrote:
> TC 9 is failing (Mac OS X 10.6),
Yeah, I can reproduce the problem here on my OS X test box. It seems to
be related to core.ignorecase. If you put
git config core.ignorecase false
at the top of t7061, it passes on OS X. Likewise, if you set it to true,
it will start failing on Linux.
So it looks like a real bug, not a test-portability issue.
> Looking into the code, there are 2 questions:
>
> 1) echo "ignored" >.gitignore &&
> We don't need the quoting of a simple string which does not have space in it.
No, but it does not hurt anything.
> 2) : >untracked/ignored &&
> Do we need the colon here?
No, but it does not hurt anything.
-Peff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: t7061: comments and one failure
2013-01-05 11:24 ` Jeff King
@ 2013-01-05 11:29 ` Antoine Pelisse
2013-01-05 20:42 ` [PATCH] status: report ignored yet tracked directories Antoine Pelisse
1 sibling, 0 replies; 13+ messages in thread
From: Antoine Pelisse @ 2013-01-05 11:29 UTC (permalink / raw)
To: Jeff King; +Cc: Torsten Bögershausen, Git Mailing List
> Yeah, I can reproduce the problem here on my OS X test box. It seems to
> be related to core.ignorecase. If you put
>
> git config core.ignorecase false
>
> at the top of t7061, it passes on OS X. Likewise, if you set it to true,
> it will start failing on Linux.
Great, so I have a chance to reproduce and fix it. (and it gives me a
massive hint on where the bug can stand).
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] status: report ignored yet tracked directories
2013-01-05 11:24 ` Jeff King
2013-01-05 11:29 ` Antoine Pelisse
@ 2013-01-05 20:42 ` Antoine Pelisse
2013-01-05 21:27 ` Torsten Bögershausen
2013-01-05 23:03 ` Jeff King
1 sibling, 2 replies; 13+ messages in thread
From: Antoine Pelisse @ 2013-01-05 20:42 UTC (permalink / raw)
To: tboegi, peff; +Cc: git, Antoine Pelisse
Tracked directories (i.e. directories containing tracked files) that
are ignored must be reported as ignored if they contain untracked files.
Currently, tracked files or directories can't be reported untracked or ignored.
Remove that constraint when searching ignored files.
Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
Torsten, Jeff,
Can you please test this patch and tell me if this is better ? (t7061 is now
successful with core.ignorecase=true)
This patch applies on top of ap/status-ignored-in-ignored-directory (but
should also apply cleanly on top of next for testing purpose).
Thanks,
dir.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dir.c b/dir.c
index 9b80348..eefa8ab 100644
--- a/dir.c
+++ b/dir.c
@@ -672,7 +672,8 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)
static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len)
{
- if (cache_name_exists(pathname, len, ignore_case))
+ if (!(dir->flags & DIR_SHOW_IGNORED) &&
+ cache_name_exists(pathname, len, ignore_case))
return NULL;
ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
--
1.7.12.4.2.geb8c5b8.dirty
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] status: report ignored yet tracked directories
2013-01-05 20:42 ` [PATCH] status: report ignored yet tracked directories Antoine Pelisse
@ 2013-01-05 21:27 ` Torsten Bögershausen
2013-01-05 23:03 ` Jeff King
1 sibling, 0 replies; 13+ messages in thread
From: Torsten Bögershausen @ 2013-01-05 21:27 UTC (permalink / raw)
To: Antoine Pelisse; +Cc: tboegi, peff, git
On 05.01.13 21:42, Antoine Pelisse wrote:
> Tracked directories (i.e. directories containing tracked files) that
> are ignored must be reported as ignored if they contain untracked files.
>
> Currently, tracked files or directories can't be reported untracked or ignored.
> Remove that constraint when searching ignored files.
>
> Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
> ---
> Torsten, Jeff,
>
> Can you please test this patch and tell me if this is better ? (t7061 is now
> successful with core.ignorecase=true)
>
> This patch applies on top of ap/status-ignored-in-ignored-directory (but
> should also apply cleanly on top of next for testing purpose).
>
> Thanks,
>
> dir.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/dir.c b/dir.c
> index 9b80348..eefa8ab 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -672,7 +672,8 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)
>
> static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len)
> {
> - if (cache_name_exists(pathname, len, ignore_case))
> + if (!(dir->flags & DIR_SHOW_IGNORED) &&
> + cache_name_exists(pathname, len, ignore_case))
> return NULL;
>
> ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
> --
> 1.7.12.4.2.geb8c5b8.dirty
>
(BTW: thanks for contributing to git)
Antoine, the test is OK:
# passed all 10 test(s)
================
I'm not sure if I am happy with the commit message, so I try to have an improved
version below, which may be a starting point for a discussion:
git status: report ignored directories correctly
A directory containing tracked files where the directory
is ignored must be reported as ignored even if it contains untracked files.
/Torsten
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] status: report ignored yet tracked directories
2013-01-05 20:42 ` [PATCH] status: report ignored yet tracked directories Antoine Pelisse
2013-01-05 21:27 ` Torsten Bögershausen
@ 2013-01-05 23:03 ` Jeff King
2013-01-06 16:40 ` Antoine Pelisse
2013-01-06 22:09 ` [PATCH v2] status: always report ignored " Antoine Pelisse
1 sibling, 2 replies; 13+ messages in thread
From: Jeff King @ 2013-01-05 23:03 UTC (permalink / raw)
To: Antoine Pelisse; +Cc: tboegi, git
On Sat, Jan 05, 2013 at 09:42:43PM +0100, Antoine Pelisse wrote:
> Tracked directories (i.e. directories containing tracked files) that
> are ignored must be reported as ignored if they contain untracked files.
>
> Currently, tracked files or directories can't be reported untracked or ignored.
> Remove that constraint when searching ignored files.
>
> Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
> ---
I was expecting to see some explanation of the user-visible bug here. In
other words, what does this fix, and why does the bug only happen when
core.ignorecase is set.
Looking at your fix and remembering how the index hashing works, I think
the answer is that:
1. This bug only affects directories, because they are the only thing
that can be simultaneously "ignored and untracked" and "tracked"
(i.e., they have entries of both, and we are using
DIR_SHOW_OTHER_DIRECTORIES).
2. When core.ignorecase is false, the index name hash contains only
the file entries, and cache_name_exists returns an exact match. So
it doesn't matter if we make an extra check when adding the
directory via dir_add_name; we know that it will not be there, and
the final check is a no-op.
3. When core.ignorecase is true, we also store directory entries in
the index name hash, and this extra check is harmful; the entry
does not really exist in the index, and we still need to add it.
But that makes me wonder. In the ignorecase=false case, I claimed that
the check in dir_add_name is a no-op for mixed tracked/ignored
directories. But it is presumably not a no-op for other cases. Your
patch only turns it off when DIR_SHOW_IGNORED is set. But is it possible
for us to have DIR_SHOW_IGNORED set, _and_ to pass in a path that exists
in the index as a regular file?
I think in the normal file case, we'd expect treat_path to just tell us
that it is handled, and we would not ever call dir_add_name in the first
place. But what if we have an index entry for a file, but the working
tree now contains a directory?
I _think_ we still do not hit this code path in that instance, because
we will end up in treat_directory, and we will end up checking
directory_exists_in_index. And I cannot get it to misbehave in practice.
So I think your fix is correct, but the exact how and why is a bit
subtle.
-Peff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] status: report ignored yet tracked directories
2013-01-05 23:03 ` Jeff King
@ 2013-01-06 16:40 ` Antoine Pelisse
2013-01-07 8:33 ` Jeff King
2013-01-06 22:09 ` [PATCH v2] status: always report ignored " Antoine Pelisse
1 sibling, 1 reply; 13+ messages in thread
From: Antoine Pelisse @ 2013-01-06 16:40 UTC (permalink / raw)
To: Jeff King; +Cc: Torsten Bögershausen, git
On Sun, Jan 6, 2013 at 12:03 AM, Jeff King <peff@peff.net> wrote:
> On Sat, Jan 05, 2013 at 09:42:43PM +0100, Antoine Pelisse wrote:
>
>> Tracked directories (i.e. directories containing tracked files) that
>> are ignored must be reported as ignored if they contain untracked files.
>>
>> Currently, tracked files or directories can't be reported untracked or ignored.
>> Remove that constraint when searching ignored files.
>>
>> Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
>> ---
>
> I was expecting to see some explanation of the user-visible bug here. In
> other words, what does this fix, and why does the bug only happen when
> core.ignorecase is set.
I spent a couple of hours trying to understand that issue, and even if
I ended-up with pretty much the same points as you do below, I was not
confident enough to phrase it like you just did.
> Looking at your fix and remembering how the index hashing works, I think
> the answer is that:
>
> 1. This bug only affects directories, because they are the only thing
> that can be simultaneously "ignored and untracked" and "tracked"
> (i.e., they have entries of both, and we are using
> DIR_SHOW_OTHER_DIRECTORIES).
>
> 2. When core.ignorecase is false, the index name hash contains only
> the file entries, and cache_name_exists returns an exact match. So
> it doesn't matter if we make an extra check when adding the
> directory via dir_add_name; we know that it will not be there, and
> the final check is a no-op.
>
> 3. When core.ignorecase is true, we also store directory entries in
> the index name hash, and this extra check is harmful; the entry
> does not really exist in the index, and we still need to add it.
Yes, because of this couple of lines I guess (name-hash.c, hash_index_entry()):
if (ignore_case)
hash_index_entry_directories(istate, ce);
> But that makes me wonder. In the ignorecase=false case, I claimed that
> the check in dir_add_name is a no-op for mixed tracked/ignored
> directories. But it is presumably not a no-op for other cases. Your
> patch only turns it off when DIR_SHOW_IGNORED is set. But is it possible
> for us to have DIR_SHOW_IGNORED set, _and_ to pass in a path that exists
> in the index as a regular file?
I don't think so, because of the optimization I added in my previous
patch, in treat_file():
/*
* Optimization:
* Don't spend time on indexed files, they won't be
* added to the list anyway
*/
struct cache_entry *ce = index_name_exists(&the_index,
path->buf, path->len, ignore_case);
It's no longer an optimization but a required step, I will update the comment.
> I think in the normal file case, we'd expect treat_path to just tell us
> that it is handled, and we would not ever call dir_add_name in the first
> place. But what if we have an index entry for a file, but the working
> tree now contains a directory?
The directory is treated as any other untracked directory (it never
matches indexed file because of the trailing /).
> I _think_ we still do not hit this code path in that instance, because
> we will end up in treat_directory, and we will end up checking
> directory_exists_in_index. And I cannot get it to misbehave in practice.
> So I think your fix is correct, but the exact how and why is a bit
> subtle.
Thanks a lot for the help, I will try to come up with a better commit
message now.
> -Peff
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2] status: always report ignored tracked directories
2013-01-05 23:03 ` Jeff King
2013-01-06 16:40 ` Antoine Pelisse
@ 2013-01-06 22:09 ` Antoine Pelisse
2013-01-07 17:21 ` Torsten Bögershausen
2013-01-07 19:06 ` Junio C Hamano
1 sibling, 2 replies; 13+ messages in thread
From: Antoine Pelisse @ 2013-01-06 22:09 UTC (permalink / raw)
To: Jeff King; +Cc: Antoine Pelisse, tboegi, git
Tracked directories (i.e. directories containing tracked files) that
are ignored must be reported as ignored if they contain untracked files.
Currently, files in the index can't be reported as ignored and are
automatically dropped from the list:
- When core.ignorecase is false, directories (which are not directly
tracked) are not listed as part of the index, and the directory can be
shown as ignored.
- When core.ignorecase is true on the other hand, directories are
reported as part of the index, and the directory is dropped, thus not
displayed as ignored.
Fix that behavior by allowing indexed file to be added when looking for
ignored files.
- Ignored tracked and untracked directories are treated the same way
when looking for ignored files, so we should not care about their index
status.
- Files are dismissed by treat_file() if they belong to the
index, so that step would have been a no-op anyway.
Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
dir.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/dir.c b/dir.c
index 9b80348..f836590 100644
--- a/dir.c
+++ b/dir.c
@@ -672,7 +672,8 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)
static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len)
{
- if (cache_name_exists(pathname, len, ignore_case))
+ if (!(dir->flags & DIR_SHOW_IGNORED) &&
+ cache_name_exists(pathname, len, ignore_case))
return NULL;
ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
@@ -877,11 +878,7 @@ static int treat_file(struct dir_struct *dir, struct strbuf *path, int exclude,
if (exclude)
exclude_file = !(dir->flags & DIR_SHOW_IGNORED);
else if (dir->flags & DIR_SHOW_IGNORED) {
- /*
- * Optimization:
- * Don't spend time on indexed files, they won't be
- * added to the list anyway
- */
+ /* Always exclude indexed files */
struct cache_entry *ce = index_name_exists(&the_index,
path->buf, path->len, ignore_case);
--
1.7.12.4.3.g90f5e2d
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] status: report ignored yet tracked directories
2013-01-06 16:40 ` Antoine Pelisse
@ 2013-01-07 8:33 ` Jeff King
0 siblings, 0 replies; 13+ messages in thread
From: Jeff King @ 2013-01-07 8:33 UTC (permalink / raw)
To: Antoine Pelisse; +Cc: Torsten Bögershausen, git
On Sun, Jan 06, 2013 at 05:40:46PM +0100, Antoine Pelisse wrote:
> > Looking at your fix and remembering how the index hashing works, I think
> > the answer is that:
> >
> > 1. This bug only affects directories, because they are the only thing
> > that can be simultaneously "ignored and untracked" and "tracked"
> > (i.e., they have entries of both, and we are using
> > DIR_SHOW_OTHER_DIRECTORIES).
> >
> > 2. When core.ignorecase is false, the index name hash contains only
> > the file entries, and cache_name_exists returns an exact match. So
> > it doesn't matter if we make an extra check when adding the
> > directory via dir_add_name; we know that it will not be there, and
> > the final check is a no-op.
> >
> > 3. When core.ignorecase is true, we also store directory entries in
> > the index name hash, and this extra check is harmful; the entry
> > does not really exist in the index, and we still need to add it.
>
> Yes, because of this couple of lines I guess (name-hash.c, hash_index_entry()):
>
> if (ignore_case)
> hash_index_entry_directories(istate, ce);
Exactly. I couldn't remember at first why this was the case, but after
reading 5102c61 (Add case insensitivity support for directories when
using git status, 2010-10-03) again, I think it is because we cannot do
a partial-name lookup via the hash (i.e., the hash for "foo/" and
"foo/bar" have no relation to each other). Not related to your patch,
obviously, but it was the missing piece for me to understand why the
code was doing what it does.
> > I think in the normal file case, we'd expect treat_path to just tell us
> > that it is handled, and we would not ever call dir_add_name in the first
> > place. But what if we have an index entry for a file, but the working
> > tree now contains a directory?
>
> The directory is treated as any other untracked directory (it never
> matches indexed file because of the trailing /).
Ah, right. That makes sense.
> > I _think_ we still do not hit this code path in that instance, because
> > we will end up in treat_directory, and we will end up checking
> > directory_exists_in_index. And I cannot get it to misbehave in practice.
> > So I think your fix is correct, but the exact how and why is a bit
> > subtle.
>
> Thanks a lot for the help, I will try to come up with a better commit
> message now.
Thanks. I think the patch is right, but the reasoning is just a bit
subtle.
-Peff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] status: always report ignored tracked directories
2013-01-06 22:09 ` [PATCH v2] status: always report ignored " Antoine Pelisse
@ 2013-01-07 17:21 ` Torsten Bögershausen
2013-01-07 17:50 ` Junio C Hamano
2013-01-07 19:06 ` Junio C Hamano
1 sibling, 1 reply; 13+ messages in thread
From: Torsten Bögershausen @ 2013-01-07 17:21 UTC (permalink / raw)
To: Antoine Pelisse, Nguyen Thai Ngoc Duy; +Cc: Jeff King, tboegi, git
On 06.01.13 23:09, Antoine Pelisse wrote:
[snip]
> Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
> ---
> dir.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/dir.c b/dir.c
> index 9b80348..f836590 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -672,7 +672,8 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)
>
> static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len)
> {
> - if (cache_name_exists(pathname, len, ignore_case))
> + if (!(dir->flags & DIR_SHOW_IGNORED) &&
> + cache_name_exists(pathname, len, ignore_case))
> return NULL;
>
> ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
> @@ -877,11 +878,7 @@ static int treat_file(struct dir_struct *dir, struct strbuf *path, int exclude,
> if (exclude)
> exclude_file = !(dir->flags & DIR_SHOW_IGNORED);
> else if (dir->flags & DIR_SHOW_IGNORED) {
> - /*
> - * Optimization:
> - * Don't spend time on indexed files, they won't be
> - * added to the list anyway
> - */
> + /* Always exclude indexed files */
> struct cache_entry *ce = index_name_exists(&the_index,
> path->buf, path->len, ignore_case);
>
> --
> 1.7.12.4.3.g90f5e2d
>
The bad news: the patch does not apply.
The good news: t7061 passes on pu,
and dir.c seems to be changes as needed:
commit 1f4e17c6c9833f17dc6bbf045f8a8d6378dcb417
Merge: dee1fa4 cc37e5b
Author: Junio C Hamano <gitster@pobox.com>
Date: Sun Jan 6 23:46:29 2013 -0800
Merge branch 'nd/parse-pathspec' into pu
which comes from Duy:
commit cc37e5bf18ca11d9a884bddfebcdff61df3e6279
Author: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date: Sun Jan 6 13:21:08 2013 +0700
Convert more init_pathspec() to parse_pathspec()
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] status: always report ignored tracked directories
2013-01-07 17:21 ` Torsten Bögershausen
@ 2013-01-07 17:50 ` Junio C Hamano
0 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2013-01-07 17:50 UTC (permalink / raw)
To: Torsten Bögershausen
Cc: Antoine Pelisse, Nguyen Thai Ngoc Duy, Jeff King, git
Torsten Bögershausen <tboegi@web.de> writes:
> The bad news: the patch does not apply.
Huh, isn't this already queued as 22ccf86 (status: always report
ignored tracked directories, 2013-01-06)?
> The good news: t7061 passes on pu,
> and dir.c seems to be changes as needed:
>
> commit 1f4e17c6c9833f17dc6bbf045f8a8d6378dcb417
> Merge: dee1fa4 cc37e5b
> Author: Junio C Hamano <gitster@pobox.com>
> Date: Sun Jan 6 23:46:29 2013 -0800
>
> Merge branch 'nd/parse-pathspec' into pu
>
> which comes from Duy:
>
> commit cc37e5bf18ca11d9a884bddfebcdff61df3e6279
> Author: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> Date: Sun Jan 6 13:21:08 2013 +0700
>
> Convert more init_pathspec() to parse_pathspec()
Yes, it needs conflict resolution with other topics in flight, but
the thing to test is to see if the result of merging 22ccf86 into
the 'master' branch does what we want; the newer topic is still in
flux and we know it will be rerolled before it gets into testable
shape.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] status: always report ignored tracked directories
2013-01-06 22:09 ` [PATCH v2] status: always report ignored " Antoine Pelisse
2013-01-07 17:21 ` Torsten Bögershausen
@ 2013-01-07 19:06 ` Junio C Hamano
2013-01-07 20:24 ` Antoine Pelisse
1 sibling, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2013-01-07 19:06 UTC (permalink / raw)
To: Antoine Pelisse; +Cc: Jeff King, tboegi, git
Antoine Pelisse <apelisse@gmail.com> writes:
First, thanks for working on this.
The explanation is a bit confusing, especially for people like me,
as it does not make it clear that there are two kinds of "paths in
the index". Files can be added to the index ("git add" and then
shown via "ls-files") and these are what we usually call "files in
the index". But there is a separate "name hash" that keeps track of
"paths the index knows about" in play, and that is what is discussed
in the description.
> Tracked directories (i.e. directories containing tracked files)
> that are ignored must be reported as ignored if they contain
> untracked files.
>
> Currently, files in the index can't be reported as ignored and are
> automatically dropped from the list:
"file in the index" will never be ignored, period. Some paths the
index knows about, namely, directory names in name hash, may need to
be reported as ignored.
It is not clear what "list" the above "dropped from the list" refers
to. The list of paths that becomes the result of "status"?
> - When core.ignorecase is false, directories (which are not directly
> tracked) are not listed as part of the index, and the directory can be
> shown as ignored.
>
> - When core.ignorecase is true on the other hand, directories are
> reported as part of the index, and the directory is dropped, thus not
> displayed as ignored.
>
> Fix that behavior by allowing indexed file to be added when looking for
> ignored files.
>
> - Ignored tracked and untracked directories are treated the same way
> when looking for ignored files, so we should not care about their index
> status.
> - Files are dismissed by treat_file() if they belong to the
> index, so that step would have been a no-op anyway.
Here is my attempt...
When enumerating paths that are ignored, paths the index knows
about are not included in the result. The "index knows about"
check is done by consulting the name hash, not the actual
contents of the index:
- When core.ignorecase is false, directory names are not in the
name hash, and ignored ones are shown as ignored (directories
can never be tracked anyway).
- When core.ignorecase is true, however, the name hash keeps
track of the names of directories, in order to detect
additions of the paths under different cases. This causes
ignored directories to be mistakenly excluded when
enumerating ignored paths.
Stop excluding directories that are in the name hash when
looking for ignored files in dir_add_name(); the names that are
actually in the index are excluded much earlier in the callchain
in treat_file(), so this fix will not make them mistakenly
identified as ignored.
Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/dir.c b/dir.c
index 9b80348..f836590 100644
--- a/dir.c
+++ b/dir.c
@@ -672,7 +672,8 @@ static struct dir_entry *dir_entry_new(const char *pathname, int len)
static struct dir_entry *dir_add_name(struct dir_struct *dir, const char *pathname, int len)
{
- if (cache_name_exists(pathname, len, ignore_case))
+ if (!(dir->flags & DIR_SHOW_IGNORED) &&
+ cache_name_exists(pathname, len, ignore_case))
return NULL;
ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
@@ -877,11 +878,7 @@ static int treat_file(struct dir_struct *dir, struct strbuf *path, int exclude,
if (exclude)
exclude_file = !(dir->flags & DIR_SHOW_IGNORED);
else if (dir->flags & DIR_SHOW_IGNORED) {
- /*
- * Optimization:
- * Don't spend time on indexed files, they won't be
- * added to the list anyway
- */
+ /* Always exclude indexed files */
struct cache_entry *ce = index_name_exists(&the_index,
path->buf, path->len, ignore_case);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2] status: always report ignored tracked directories
2013-01-07 19:06 ` Junio C Hamano
@ 2013-01-07 20:24 ` Antoine Pelisse
0 siblings, 0 replies; 13+ messages in thread
From: Antoine Pelisse @ 2013-01-07 20:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, Torsten Bögershausen, git
> Here is my attempt...
>
> When enumerating paths that are ignored, paths the index knows
> about are not included in the result. The "index knows about"
> check is done by consulting the name hash, not the actual
> contents of the index:
>
> - When core.ignorecase is false, directory names are not in the
> name hash, and ignored ones are shown as ignored (directories
> can never be tracked anyway).
>
> - When core.ignorecase is true, however, the name hash keeps
> track of the names of directories, in order to detect
> additions of the paths under different cases. This causes
> ignored directories to be mistakenly excluded when
> enumerating ignored paths.
>
> Stop excluding directories that are in the name hash when
> looking for ignored files in dir_add_name(); the names that are
> actually in the index are excluded much earlier in the callchain
> in treat_file(), so this fix will not make them mistakenly
> identified as ignored.
>
> Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
> Reviewed-by: Jeff King <peff@peff.net>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
I like it a lot, thanks to both of you
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-01-07 20:24 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-05 11:07 t7061: comments and one failure Torsten Bögershausen
2013-01-05 11:24 ` Jeff King
2013-01-05 11:29 ` Antoine Pelisse
2013-01-05 20:42 ` [PATCH] status: report ignored yet tracked directories Antoine Pelisse
2013-01-05 21:27 ` Torsten Bögershausen
2013-01-05 23:03 ` Jeff King
2013-01-06 16:40 ` Antoine Pelisse
2013-01-07 8:33 ` Jeff King
2013-01-06 22:09 ` [PATCH v2] status: always report ignored " Antoine Pelisse
2013-01-07 17:21 ` Torsten Bögershausen
2013-01-07 17:50 ` Junio C Hamano
2013-01-07 19:06 ` Junio C Hamano
2013-01-07 20:24 ` Antoine Pelisse
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).