git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Adam Piatyszek <ediap@users.sourceforge.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	pradeep singh rautela <rautelap@gmail.com>,
	git@vger.kernel.org
Subject: Re: Why does git track directory listed in .gitignore/".git/info/exclude"?
Date: Wed, 30 Jan 2008 12:39:24 -0800	[thread overview]
Message-ID: <7vprvjgi9v.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <47A06EF9.60704@users.sourceforge.net> (Adam Piatyszek's message of "Wed, 30 Jan 2008 13:35:05 +0100")

Adam Piatyszek <ediap@users.sourceforge.net> writes:

> In my opinion, the exclude matching routine should convert "dir/" to
> "dir", especially that the "git status" command lists untracked
> directories with the trailing slash "/", e.g:
>
>   ediap@lespaul ~/git/acm_ofdm $ git status
>   # On branch master
>   # Untracked files:
>   #   (use "git add <file>..." to include in what will be committed)
>   #
>   #       ldpc13.bm
>   #       results/
>
> So, most newbies will try to add "dir/" to .gitignore or
> .git/info/exclude instead of "dir" in such a case.
>
> Can you seen any drawbacks of such modification?

I do not see a problem if you are saying:

	when the user has an entry 'dir/' in .gitignore, it
	should match directory 'dir'.

However, there is a subtle problem in a naive implementation of
that.  IOW,

	when the user has an entry 'dir/' in .gitignore, behave
	as if the entry were 'dir' instead.

is wrong.

When you say "foo", you mean "I want either 'foo' that is a
non-directory, or everything under 'foo' if that is a
directory".  When you say "foo/", you are saying "I do not want
'foo' if it is a non-directory.  I want everything under 'foo'
if and only if that is a directory".  Compare:

	git ls-files -s Makefile/
        git ls-files -s Makefile

The first one is silent, and the latter answers.  On the other
hand, for a directory, both of these give you the same:

	git ls-files Documentation/
        git ls-files Documentation

  reply	other threads:[~2008-01-30 20:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-23 13:54 Why does git track directory listed in .gitignore/".git/info/exclude"? pradeep singh rautela
2008-01-23 14:04 ` pradeep singh rautela
2008-01-23 21:17   ` Linus Torvalds
2008-01-24 10:44     ` pradeep singh rautela
2008-01-30 12:35     ` Adam Piatyszek
2008-01-30 20:39       ` Junio C Hamano [this message]
2008-01-30 21:06         ` Junio C Hamano
2008-01-31  7:05         ` Adam Piatyszek
2008-01-31  8:54           ` *Re: " Junio C Hamano
2008-01-31  9:17             ` [PATCH] gitignore(5): Allow "foo/" in ignore list to match directory "foo" Junio C Hamano
2008-01-31  9:41               ` Jeff King
2008-01-31 10:35                 ` Junio C Hamano
2008-01-31 10:42                   ` Jeff King
2008-01-31 11:38                     ` Johannes Schindelin
2008-01-31 11:56                       ` pradeep singh rautela
2008-01-31 21:51                         ` Junio C Hamano
2008-01-31 22:53                           ` Adam Piatyszek
2008-02-01  8:56                           ` Andreas Ericsson
2008-01-31 12:29                       ` Adam Piatyszek
2008-01-23 21:11 ` Why does git track directory listed in .gitignore/".git/info/exclude"? Wayne Davison

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

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

  git send-email \
    --in-reply-to=7vprvjgi9v.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=ediap@users.sourceforge.net \
    --cc=git@vger.kernel.org \
    --cc=rautelap@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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.
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 NNTP newsgroup(s).