On Wed, Jul 17, 2019 at 09:35:34AM -0700, Junio C Hamano wrote: > "Thurston via GitGitGadget" <gitgitgadget@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx/