git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* .gitignore Bug Report on the behavior of *
@ 2010-09-25 19:23 Seth Robertson
  2010-09-25 20:03 ` Johannes Sixt
  0 siblings, 1 reply; 5+ messages in thread
From: Seth Robertson @ 2010-09-25 19:23 UTC (permalink / raw)
  To: git


I'm not sure if this is a documentation bug, an actual bug, or my
mis-interpretation of what is supposed to happen, however, this
behavior was not expected by other people as well.  This was tested
using git 1.7.2.3 and 1.7.3

My sample configuration:
----------------------------------------------------------------------
mkdir foo; cd foo; git init; echo A > A; mkdir B; echo B > B/B
git add .; git commit -a -m "initial"
----------------------------------------------------------------------

# Properly shows X and B/XX as untracked, as I expected
echo X > X; echo XX > B/XX; git status

# I expected B/XX to show up as untracked
rm -f .gitignore B/.gitignore
echo '*' > .gitignore; echo '!*' > B/.gitignore; git status

# I expected B/XX to show up as untracked
rm -f .gitignore B/.gitignore
echo '/*' > .gitignore; git status

# Works as I expected
rm -f .gitignore B/.gitignore
echo '/*X' > .gitignore; git status

# Works as I expected
rm -f .gitignore B/.gitignore
echo '*X' > .gitignore; echo '!*X' > B/.gitignore; git status

# Works as I expected
rm -f .gitignore B/.gitignore
echo -e '/*\n!/B' > .gitignore; git status

					-Seth Robertson

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .gitignore Bug Report on the behavior of *
  2010-09-25 19:23 .gitignore Bug Report on the behavior of * Seth Robertson
@ 2010-09-25 20:03 ` Johannes Sixt
  2010-09-25 20:40   ` [PATCH] " Seth Robertson
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Johannes Sixt @ 2010-09-25 20:03 UTC (permalink / raw)
  To: Seth Robertson; +Cc: git

On Samstag, 25. September 2010, Seth Robertson wrote:
> # Properly shows X and B/XX as untracked, as I expected
> echo X > X; echo XX > B/XX; git status
>
> # I expected B/XX to show up as untracked
> rm -f .gitignore B/.gitignore
> echo '*' > .gitignore; echo '!*' > B/.gitignore; git status

You should update your expectations to match what you got. ;-)

To show why your expectations are wrong, consider a *huge* and *deep* 
directory with thousands and thousands of subdirectories, call it "usr", that 
should be ignored. The .gitignore at the top-level would just say:

  /usr

Do you really expect git to walk down this ignored directory, just to make 
double-sure that really, really down there does nowhere exist a .gitignore 
that says "oh, wait, don't ignore *this* file"?

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Re: .gitignore Bug Report on the behavior of *
  2010-09-25 20:03 ` Johannes Sixt
@ 2010-09-25 20:40   ` Seth Robertson
  2010-09-25 20:53   ` Ævar Arnfjörð Bjarmason
  2010-09-25 23:27   ` Sverre Rabbelier
  2 siblings, 0 replies; 5+ messages in thread
From: Seth Robertson @ 2010-09-25 20:40 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git


In message <201009252203.48820.j6t@kdbg.org>, Johannes Sixt writes:

    On Samstag, 25. September 2010, Seth Robertson wrote:
    > # Properly shows X and B/XX as untracked, as I expected
    > echo X > X; echo XX > B/XX; git status
    >
    > # I expected B/XX to show up as untracked
    > rm -f .gitignore B/.gitignore
    > echo '*' > .gitignore; echo '!*' > B/.gitignore; git status

    You should update your expectations to match what you got. ;-)

    To show why your expectations are wrong, consider a *huge* and
    *deep* directory with thousands and thousands of subdirectories,
    call it "usr", that should be ignored. The .gitignore at the
    top-level would just say:

      /usr

    Do you really expect git to walk down this ignored directory, just to make
    double-sure that really, really down there does nowhere exist a .gitignore
    that says "oh, wait, don't ignore *this* file"?

Hmm.  No, not really, but having a .gitignore in a directory which has
tracked git files in it seems somehow different, and at least to me the
documentation of .gitignore suggests a different algorithm.  How about
this for a documentation patch?

Signed-off-by: Seth Robertson <in-gitvger@baka.org>
----------------------------------------------------------------------
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index 7dc2e8b..4f825d8 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -33,6 +33,8 @@ precedence, the last matching pattern decides the outcome):
    as the path, or in any parent directory, with patterns in the
    higher level files (up to the toplevel of the work tree) being overridden
    by those in lower level files down to the directory containing the file.
+   Any pattern causing a directory to be ignored will cause
+   any `.gitignore` file under that dirctory to be ignored.
    These patterns match relative to the location of the
    `.gitignore` file.  A project normally includes such
    `.gitignore` files in its repository, containing patterns for

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: .gitignore Bug Report on the behavior of *
  2010-09-25 20:03 ` Johannes Sixt
  2010-09-25 20:40   ` [PATCH] " Seth Robertson
@ 2010-09-25 20:53   ` Ævar Arnfjörð Bjarmason
  2010-09-25 23:27   ` Sverre Rabbelier
  2 siblings, 0 replies; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-09-25 20:53 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Seth Robertson, git

On Sat, Sep 25, 2010 at 20:03, Johannes Sixt <j6t@kdbg.org> wrote:
> On Samstag, 25. September 2010, Seth Robertson wrote:
>> # Properly shows X and B/XX as untracked, as I expected
>> echo X > X; echo XX > B/XX; git status
>>
>> # I expected B/XX to show up as untracked
>> rm -f .gitignore B/.gitignore
>> echo '*' > .gitignore; echo '!*' > B/.gitignore; git status
>
> You should update your expectations to match what you got. ;-)
>
> To show why your expectations are wrong, consider a *huge* and *deep*
> directory with thousands and thousands of subdirectories, call it "usr", that
> should be ignored. The .gitignore at the top-level would just say:
>
>  /usr
>
> Do you really expect git to walk down this ignored directory, just to make
> double-sure that really, really down there does nowhere exist a .gitignore
> that says "oh, wait, don't ignore *this* file"?

That wouldn't be so expensive if the expectation that the .gitignore
in /usr would only be considered if it had already been commited. Then
we'd just have to check if we have a tree for /usr, and whether
there's a gitignore there.

But doing this in the top-level .gitignore if possible is the best
solution.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: .gitignore Bug Report on the behavior of *
  2010-09-25 20:03 ` Johannes Sixt
  2010-09-25 20:40   ` [PATCH] " Seth Robertson
  2010-09-25 20:53   ` Ævar Arnfjörð Bjarmason
@ 2010-09-25 23:27   ` Sverre Rabbelier
  2 siblings, 0 replies; 5+ messages in thread
From: Sverre Rabbelier @ 2010-09-25 23:27 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Seth Robertson, git

Heya,

<threadjacking rant>

On Sat, Sep 25, 2010 at 22:03, Johannes Sixt <j6t@kdbg.org> wrote:
> Do you really expect git to walk down this ignored directory, just to make
> double-sure that really, really down there does nowhere exist a .gitignore
> that says "oh, wait, don't ignore *this* file"?

Yet when I (recursively for all files) 'git update-index
--assume-unchanged some-dir' it will still looking at all the bloody
.gitignore making it slow as moleasses.

</rant>

Of course, the above is an insane setup with a .gitignore file in each
and every directory. But it would be so nice if git Just Worked even
in insane cases!

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-25 23:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-25 19:23 .gitignore Bug Report on the behavior of * Seth Robertson
2010-09-25 20:03 ` Johannes Sixt
2010-09-25 20:40   ` [PATCH] " Seth Robertson
2010-09-25 20:53   ` Ævar Arnfjörð Bjarmason
2010-09-25 23:27   ` Sverre Rabbelier

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).