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

Re: Bug in .gitignore handling

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 26, 2008, 20:32 UTC
Message-ID
<alpine.LFD.1.00.0803261330280.2775@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.1.00.0803261324380.2775@woody.linux-foundation.org>
On Wed, 26 Mar 2008, Linus Torvalds wrote:
> 
> Basically, a path with a slash in it is considered absolute, but if the 
> slash is at the end it will only match a directory.

Actually, to clarify: a path with a slash in it *anywhere*else* than at the end will be considered absolute. At the end it means "only match directories".

So 
	foo
will match any file or directory anywhere in the tree, while
	foo/
will match a directory called "foo" anywhere in the tree, and
	/foo

will match either a file or directory called "foo", but only at the root of the repository.

And no, I didn't test it, but that's how it should work, afaik.
		Linus
Previous: Linus TorvaldsNext: Tommy Thorn
Message 5 of 7 in “Bug in .gitignore handling”
  1. Tommy ThornMar 26, 2008
  2. Junio C HamanoMar 26, 2008
  3. Tommy ThornMar 26, 2008
  4. Linus TorvaldsMar 26, 2008
  5. Linus TorvaldsMar 26, 2008
  6. Tommy ThornMar 26, 2008
  7. Junio C HamanoMar 26, 2008

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.