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

Re: [PATCH 0/1] Adding git-ignore command, tests, and documentation.

From
Jeff King <peff@peff.net>
Date
Jul 18, 2019, 20:21 UTC
Message-ID
<20190718202140.GB22038@sigill.intra.peff.net>
In-Reply-To
<xmqqmuhc1uw9.fsf@gitster-ct.c.googlers.com>
On Wed, Jul 17, 2019 at 09:35:34AM -0700, Junio C Hamano wrote:
Show 21 quoted lines
> "Thurston via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
> > Instead of managing paths and relative paths such as echo
> > "path/to/the/file.txt" >../../../../../../.gitignore git ignore
> > path/to/the/file.txt No matter what directory that is in, the correct
> > relative path will be added to the gitignore.
> 
> Hmph, do you mean you type something like this?
> 
> 	$ cd path/to/the
> 	... work in that deep directory ...
> 	... realize that file.txt in that directory needs ignoring ...
> 	$ echo path/to/the/file.txt >../../../../../../.gitignore
> 
> Wouldn't this simpler to type and less error prone, as you do not
> have to count ../?
> 
> 	$ cd path/to/the
> 	... work in that deep directory ...
> 	... realize that file.txt in that directory needs ignoring ...
> 	$ echo file.txt >.gitignore

It's also much more efficient, at least with our current implementation, as we do not have to worry about matching this entry when we are dealing with /some/other/path. See [1] for a pathological case.

I see "with our current implementation" because I could imagine a world in which we have a more trie-like structure for non-wildcard patterns. But I don't think anybody is working on such a thing.

-Peff
[1] https://public-inbox.org/git/20120329211136.GA1112@sigill.intra.peff.net/
Previous: Junio C Hamano
Message 4 of 4 in “Adding git-ignore command, tests, and documentation.”
  1. 0/1 Adding git-ignore command, tests, and documentation.Thurston via GitGitGadget, Jul 17, 2019
  2. 1/1 Adding git ignore commandThurston Stone via GitGitGadget, Jul 17, 2019
  3. Junio C HamanoJul 17, 2019
  4. Jeff KingJul 18, 2019

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.