Thread (1 message) 1 message, 1 author, 2016-06-15

Ignore pattern with trailing whitespace in .gitignore is void using git 1.8.1.5

From: Thor Andreas Rognan <hidden>
Date: 2016-06-15 22:56:20

Hi guys,

Maybe I'm doing it wrong, or maybe it's the intended behaviour,
but I find that a trailing whitespace after a pattern in .gitignore
makes the pattern void with git 1.8.1.5.

It's a subtle error to make, although cleaning undesired commits
from the git history can be educational and fun in itself.

How to reproduce:

$ > mkdir -p ~/tmp/git-ignore-test/ \
&& cd ~/tmp/git-ignore-test/ \
&& touch .gitignore .secret-passwords .secret-passwords.swp \
&& echo ".*.sw? " > .gitignore \
&& echo ".secret-passwords" >> .gitignore \
&& git init && git status

Remove the white space after ``` .*.sw?``` in .gitignore
to see the .swp file disappear:

$ > echo -e ".*.sw?\n.secret-passwords" > .gitignore > .gitignore \
&& git status

You will of course have to temporarily disable your
global .gitignore file if you handle vim swap files correctly there.

I am using git 1.8.1.5 installed with homebrew on os x 10.8.2.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help