Ignoring pattern in un-ignored directory not working anymore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]