git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-ls-files in subdirectories ignore higher-up .gitignore

From
Junio C Hamano <junkio@cox.net>
Date
Jan 25, 2006, 02:08 UTC
Message-ID
<7vhd7t3vqf.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<1138125570.24415.11.camel@dv>
Pavel Roskin <proski@gnu.org> writes:
Show 11 quoted lines
> This can be demonstrated in git's own repository:
>
> $ touch t/test.o
> $ git-ls-files --others --exclude-per-directory=.gitignore
> $ cd t
> $ git-ls-files --others --exclude-per-directory=.gitignore
> test.o
> $
>
> Before I attempt to fix it, I'd like to make sure it's a bug, not a
> feature.

I am not sure if that is a bug or a feature, but you are right. We do not bother to go uplevel and look for .gitignore in the current code.

It would probably be a welcome addition if your fix made these two sequences work similarly modulo leading paths from the command output. I think it is natural to expect they are moral equivalents:

	(Sequence 1)
	$ touch t/test.o t/garbage
        $ git-ls-files -o --exclude-per-directory=.gitignore t/
	(Sequence 2)
	$ touch t/test.o t/garbage
        $ cd t
        $ git-ls-files -o --exclude-per-directory=.gitignore
Previous: Pavel RoskinNext: Sam Ravnborg
Message 2 of 6 in “git-ls-files in subdirectories ignore higher-up .gitignore”
  1. Pavel RoskinJan 24, 2006
  2. Junio C HamanoJan 25, 2006
  3. Sam RavnborgJan 25, 2006
  4. ls-files: honour per-directory ignore file from higher directories.Junio C Hamano, Feb 9, 2006
  5. Pavel RoskinFeb 10, 2006
  6. Junio C HamanoFeb 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.