From: Moritz Bunkus <moritz@bunkus.org>
To: git@vger.kernel.org
Subject: Ignoring pattern in un-ignored directory not working anymore
Date: Thu, 6 Jun 2013 10:29:08 +0200 [thread overview]
Message-ID: <CANPayMS19-bjgWRMYrRcGYzKgEo_0Az_8emeDrKwxx9RguDbwg@mail.gmail.com> (raw)
Hey,
What I want to do:
* ignore certain patterns completely
* but keep one important directoy
* but not the patterns from the first step that are located within
that directory.
Concrete example: I'm tracking certain parts of my $HOME including
~/.emacs.d/ -- but I don't want the compiled Emacs Lisp files therein.
This used to work until recently, though I'm not sure up to which
version excatly. I'm on Arch Linux and therefore usually pretty much
up to date. My current git version is 1.8.3.
More details and how to reproduce:
My ~/.gitignore usually looked like this:
--- cut ---------------------------------------------------------
/*
*.elc
!/.emacs.d/
--- cut ---------------------------------------------------------
With this setup the scenario described at the beginning was possible.
Now it's not as all files within ~/.emacs.d are always considered
regardless of what patterns came before.
Not even putting '*.elc' into ~/.emacs.d/.gitignore will work in such
a case, even though gitignore(5) seems to imply that .gitignore files
closer to the actual file have higher precendence.
Here's a copy & paste of a simple session demonstrating the problem on
a new repo:
--- cut ---------------------------------------------------------
[0 mbunkus@chai-latte ~/tmp/repo] git init
Initialized empty Git repository in /home/mbunkus/tmp/repo/.git/
[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] cat > .gitignore
# Ignore all compiled Emacs lisp files
*.elc
# But I want this one directory
!important/
[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] mkdir important
[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] touch important/wanted.el
[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] git add important
[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] git commit -m 'all ok'
[master (root-commit) 5ab6055] all ok
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 important/wanted.el
[0 mbunkus@chai-latte (master) ~/tmp/repo] touch unwanted1.elc
[0 mbunkus@chai-latte (master) ~/tmp/repo] touch important/unwanted2.elc
[0 mbunkus@chai-latte (master) ~/tmp/repo] git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
# important/unwanted2.elc
nothing added to commit but untracked files present (use "git add" to track)
[0 mbunkus@chai-latte (master) ~/tmp/repo] cat > .gitignore
# Second try: list *.elc twice
*.elc
!important/
*.elc
[0 mbunkus@chai-latte (master) ~/tmp/repo] git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
# important/unwanted2.elc
nothing added to commit but untracked files present (use "git add" to track)
[0 mbunkus@chai-latte (master) ~/tmp/repo] cat > .gitignore
# Third times' the charm
*.elc
!important/
important/**/*elc
[0 mbunkus@chai-latte (master) ~/tmp/repo] git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
# important/unwanted2.elc
nothing added to commit but untracked files present (use "git add" to track)
[0 mbunkus@chai-latte (master) ~/tmp/repo] echo '*.elc' > important/.gitignore
[0 mbunkus@chai-latte (master) ~/tmp/repo] git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
# important/.gitignore
# important/unwanted2.elc
nothing added to commit but untracked files present (use "git add" to track)
--- cut ---------------------------------------------------------
Kind regards,
mosu
next reply other threads:[~2013-06-06 8:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 8:29 Moritz Bunkus [this message]
2013-06-06 18:19 ` Ignoring pattern in un-ignored directory not working anymore Junio C Hamano
2013-06-06 21:08 ` Moritz Bunkus
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=CANPayMS19-bjgWRMYrRcGYzKgEo_0Az_8emeDrKwxx9RguDbwg@mail.gmail.com \
--to=moritz@bunkus.org \
--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).