git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Thurston via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 0/1] Adding git-ignore command, tests, and documentation.
Date: Thu, 18 Jul 2019 16:21:40 -0400	[thread overview]
Message-ID: <20190718202140.GB22038@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqmuhc1uw9.fsf@gitster-ct.c.googlers.com>

On Wed, Jul 17, 2019 at 09:35:34AM -0700, Junio C Hamano wrote:

> "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/

      reply	other threads:[~2019-07-18 20:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  2:49 [PATCH 0/1] Adding git-ignore command, tests, and documentation Thurston via GitGitGadget
2019-07-17  2:49 ` [PATCH 1/1] Adding git ignore command Thurston Stone via GitGitGadget
2019-07-17 16:35 ` [PATCH 0/1] Adding git-ignore command, tests, and documentation Junio C Hamano
2019-07-18 20:21   ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190718202140.GB22038@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).