In addition to the two you listed I've seen that wildcards won't match against directories, only files.
How does Perforce ignore file syntax differ from gitignore syntax?
题
What fraction of .gitignore file syntax Perforce was able to implement?
The Perforce documentation for P4IGNORE shows basic ignores and un-ignores with patterns: http://www.perforce.com/perforce/r12.1/manuals/cmdref/env.P4IGNORE.html
As best I can tell, Perforce does not support:
# Ignore file.txt, but not subdir/file.txt
/file.txt
# Ignore directories named foo, but not files named foo
foo/
Are there any other differences in the ignore file processing?
解决方案 2
其他提示
I had a similar question and then found this article where I learned that Perforce does accept .gitignore files.
In fact, you can specify more than one filename in P4IGNORE. In reality, my P4IGNORE looks like this (this is a new feature in 2015.2):
P4IGNORE=$home/.p4ignore;.gitignore;.p4ignore;
Also, as far as I can tell (the P4IGNORE mechanism is incompletely documented):
P4IGNORE seems to have no way to escape # (the hash sign, a character that I really want to have in P4IGNORE since EMACS creates backup files named #filename#.
It looks like # in P4IGNORE is a comment character, but only if the first character on a line.
So
*#*
seems to ignore all files with # in them. i.e. it seems to be the equivalent of Perl regexp qr{^.#.$}.
This is a bit scary, since if # was the normal comment character in most systems, the pattern # would be a * followed by a comment #*, and would ignore all files. But it seems to work.
(Git's handling of # is a bit special as well.)
P4IGNORE does not seem to handle patterns such as
# matches any single character filename
?
a single character
[seq]
matches any character in set
etc.,
so to ignore a filename with a single letter like 'a', I had to list all 62 possibilities [a-zA-Z0-9]. (I have a habit of creating tmp files like 'a', 'b' ...).
I have not yet grokked Perforce's handling of periods in filenames.
I know for sure that to ignore a filename like '.#more-crap'
you have to do
.#*
in addition to
*#*
but this may just be normal dot file hiding.
However, there have been several cases where a pattern like
tmp-*
was not catching 'tmp-foo.txt'
that I fixed by adding
tmp-*.*
(Note: most recently I have been using bzr and hg, with fully powerful regexps, so may be looking for stuff more powerful than git provides)