git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anatoly Borodin <anatoly.borodin@gmail.com>
To: git@vger.kernel.org
Subject: Re: Gitignore file exceptions are not applied to untarcked files
Date: Fri, 29 Jan 2016 20:54:30 +0000 (UTC)	[thread overview]
Message-ID: <n8gji4$bf1$1@ger.gmane.org> (raw)
In-Reply-To: xmqqd1skjkyp.fsf@gitster.mtv.corp.google.com

Hi Junio,


I've tested it with many older versions of git, as well as with the recent
v2.7.0 - it seems like this feature has been never working properly.

The script https://gist.github.com/anatolyborodin/9c581b50c584534fff28

#!/bin/sh

set -e

# a
# b
# c
# D/a
# D/b
# D/c
# E/F/a
# E/F/b
# E/F/c

mkdir -p D E/F
touch a b c D/a D/b D/c E/F/a E/F/b E/F/c

echo && echo '.gitignore' && echo '----------'
echo '*\n!b\n!D/b\n!/D/b\n!/E/*/b' > .gitignore
cat .gitignore

echo && echo 'With `--ignored`' && echo '----------'
git status --ignored

echo && echo 'Without `--ignored`' && echo '----------'
git status


The output:


.gitignore
----------
*
!b
/D/b
!/D/b
!/E/*/b

With `--ignored`
----------
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        b

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

        .gitignore
        D/
        E/
        a
        c

nothing added to commit but untracked files present (use "git add" to track)

Without `--ignored`
----------
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        b

nothing added to commit but untracked files present (use "git add" to track)



All files in the subdirectories are ignored, no matter what.


-- 
Mit freundlichen Grüßen,
Anatoly Borodin

      reply	other threads:[~2016-01-29 20:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 15:25 Gitignore file exceptions are not applied to untarcked files Assen Totin
2016-01-29 18:31 ` Junio C Hamano
2016-01-29 20:54   ` Anatoly Borodin [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

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

  git send-email \
    --in-reply-to='n8gji4$bf1$1@ger.gmane.org' \
    --to=anatoly.borodin@gmail.com \
    --cc=git@vger.kernel.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).