All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Bruce Stephens <bruce.stephens@isode.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	git@vger.kernel.org, Alex Riesen <raa.lkml@gmail.com>
Subject: Re: Odd .gitignore behaviour
Date: Thu, 15 Nov 2007 14:13:19 -0800	[thread overview]
Message-ID: <7vabpf40ow.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vir4341ok.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 15 Nov 2007 13:51:55 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> Bruce Stephens <bruce.stephens@isode.com> writes:
>
>> So I think the output from git-ls-files is as expected (as I interpret
>> the manpage and your explanation).  So is git-add just using some
>> different code?
>
> No, you found one of the longstanding bugs in dir.c:read_directory().
>
> The funny thing is that I just sent out a message pointing out
> bogus handling of per-directory exclude files in ls-files last
> night.  Somehow people have a tendency to encounter the bugs in
> the same vicinity independently.

By the way, about the problem I described briefly last night.

I never understood the intended use of -i option to ls-files,
but in your test repository (the one that has subsubdir), you
can do:

	$ git ls-files -i --exclude='a*'

to see "What paths have I already _staged_ that would have been
ignored if the exclude pattern were 'a*'".  You can abuse this
to list all the staged header files with:

	$ git ls-files -i --exclude='*.h'

but

	$ git ls-files -- '*.h'

is much simpler for that ;-).

In any case, it appears to me that the codepath used for that
"feature", and also the codepath used for -d (show deleted
files) and -m (show modified files) makes calls to excluded()
function to consult the exclusion mechanism without setting it
up properly, and I do not think

	$ git ls-files -i --exclude-per-directory=.gitignore

does what we would want.

The codepath for -o (show others) do use read_directory() which
sets up the exclusion mechanism with push/pop per-directory
exclude API, so that option should work.  But I suspect even it
did not work from a subdirectory because of the problem the
message I am responding to addresses.

  reply	other threads:[~2007-11-15 22:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-15 12:49 Odd .gitignore behaviour Bruce Stephens
2007-11-15 18:56 ` Linus Torvalds
2007-11-15 20:15   ` Bruce Stephens
2007-11-15 21:51     ` Junio C Hamano
2007-11-15 22:13       ` Junio C Hamano [this message]
2007-11-16  9:15       ` Fix per-directory exclude handing for "git add" Junio C Hamano
2007-11-16 13:50         ` Bruce Stephens
2007-11-16 15:05           ` Bruce Stephens

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=7vabpf40ow.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=bruce.stephens@isode.com \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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.