* Ignore pattern with trailing whitespace in .gitignore is void using git 1.8.1.5
[not found] <CAMn8hCd6_V2Kq_OUgBFAoOkqqmrTpN_ohcP3wM44qWvQB_8R5g@mail.gmail.com>
@ 2013-03-09 1:36 ` Thor Andreas Rognan
2013-03-09 5:25 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Thor Andreas Rognan @ 2013-03-09 1:36 UTC (permalink / raw)
To: git
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Ignore pattern with trailing whitespace in .gitignore is void using git 1.8.1.5
2013-03-09 1:36 ` Ignore pattern with trailing whitespace in .gitignore is void using git 1.8.1.5 Thor Andreas Rognan
@ 2013-03-09 5:25 ` Junio C Hamano
2013-03-09 6:28 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2013-03-09 5:25 UTC (permalink / raw)
To: Thor Andreas Rognan; +Cc: git
Thor Andreas Rognan <thor.rognan@gmail.com> writes:
> 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.
I doubt we do anything clever like that.
$ git init
$ touch hello.o "hello.o " "hello.o " hello.c
$ echo "*.o " >.gitignore
$ git status | cat -e
# On branch master$
#$
# Initial commit$
#$
# Untracked files:$
# (use "git add <file>..." to include in what will be committed)$
#$
# .gitignore$
# hello.c$
# hello.o$
# hello.o $
nothing added to commit but untracked files present (use "git add" to track)$
The user tells to ignore anything followed by a dot followed by a
lowercase Oh followed by a SP. We ignore "hello. ", but not "hello.o"
nor "hello.o " (two SPs at the end), just as told.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Ignore pattern with trailing whitespace in .gitignore is void using git 1.8.1.5
2013-03-09 5:25 ` Junio C Hamano
@ 2013-03-09 6:28 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2013-03-09 6:28 UTC (permalink / raw)
To: Thor Andreas Rognan; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
> Thor Andreas Rognan <thor.rognan@gmail.com> writes:
>
>> 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.
>
> I doubt we do anything clever like that.
> ...
> The user tells to ignore anything followed by a dot followed by a
> lowercase Oh followed by a SP. We ignore "hello. ", but not "hello.o"
> nor "hello.o " (two SPs at the end), just as told.
Of course, having said all that, I do not think anybody objects too
deeply against a patch that change the behaviour to ignore trailing
whitespaces, as long as the patch leaves an escape hatch to allow
people who do want to specify a pattern that matches with pathnames
with trailing whitespaces. Without thinking it through, perhaps
echo '*.o\ ' >.gitignore
or something?
Technically speaking, such a change is a regression, but I doubt
that many people would mind it too much.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-09 6:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAMn8hCd6_V2Kq_OUgBFAoOkqqmrTpN_ohcP3wM44qWvQB_8R5g@mail.gmail.com>
2013-03-09 1:36 ` Ignore pattern with trailing whitespace in .gitignore is void using git 1.8.1.5 Thor Andreas Rognan
2013-03-09 5:25 ` Junio C Hamano
2013-03-09 6:28 ` Junio C Hamano
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).