`--pants-ignore` doesn’t seem as flexible as gitig...
# development
h
--pants-ignore
doesn’t seem as flexible as gitignore syntax. Is that known? In the example Python repo, these all fail to properly ignore `.pid`: *
--pants-ignore='/.pids'
*
--pants-ignore='.pids/'
*
--pants-ignore='.pids'
*
--pants-ignore='./.pids/*'
You have to use: *
--pants-ignore='.pids/*'
*
--pants-ignore='/.pids/*'
(Running
./pants --pants-ignore='..' cloc '**
)
cc @hundreds-breakfast-49010
h
hm, didn't realize that
my recent changes with --pants-gitignore shouldn't have affected --pants-ignore, but it's possible they broke something, or that this bug was already in the code path
h
I confirmed that it makes no difference if this is defined in .gitignore vs. passed directly I’ll update our docs to give the correct recommendation, but people will think it’s weird when we recommend
/.pids/*
instead of
/.pids
, so it would be great to fix
h
I wonder if that code path is incorrectly using the library that determines if a path matches a gitignore-style path, or if perhaps that library itself has a bug
h
Huh, so I’m testing now if the
.
has something to do with this. I tried to reproduce with this and can’t:
Copy code
$ mkdir demo; echo 'print("hello world")\n' > demo/f.py
$ ./pants --pants-ignore='/demo' cloc demo/f.py
$ ./pants --pants-ignore='/demo/*' cloc demo/f.py
It always behaves correctly
Weird. No matter what I do,
.demo/f.py
is ignored
w
.pids
is intentionally included
h
Hm. Why? I get this:
Copy code
ERROR: Failed to scan directory "/Users/eric/DocsLocal/code/projects/example-python/.pids/watchman": Expected File, Dir or Link, but ".pids/watchman/watchman.sock" (relative to "/Users/eric/DocsLocal/code/projects/example-python") was a FileType(FileType { mode: 49152 })
w
…oh. hm.
h
This is running
./pants cloc '**'
in the example repo
happens in master too
w
it should only happen if you’ve used watchman (ie, used pantsd before this release)… although that’s not ideal
🤔 1
h
No matter what I do, .demo/f.py is ignored
This is because of the default ignore of hidden files. Okay.
w
i think there is a quick fix though… can switch the hole we punch to be pantsd specific. sorry about that.
👍 1
h
Cool. Thanks. @hundreds-breakfast-49010 it looks like
--pants-ignore
is in fact behaving properly. Sorry for the false flag
👍 1
h
so the
.pids
directory is special-cased with @witty-crayon-22786’s recent change, before the gitignore-processing code?
w
yep.
👍 2
just testing the fix, will post in a minute.
💯 2
hm. it looks like there might actually be a bad interaction with ignore… i can’t seem to make this more specific.
👍 1
Copy code
works:
	['.*/', .., '!/.pids']
doesn't work:
	['.*/', .., '!/.pids/pantsd']
i’ll keep looking at it.
@hundreds-father-404: for now, can remove the watchman socket. the latest release will not create it.
but i’ll track this as a blocker.
👍 1
h
Thanks
w
oh, poop.
It is not possible to re-include a file if a parent directory of that file is excluded.
https://git-scm.com/docs/gitignore
😐 1
h
and I don’t think we want to create yet another directory to gitignore, if posssible
Unless we remove
.pids
in favor of something new. The issue would be having two folders at the same time
w
so… this is all in support of something that is lightly a hack.
i’ll think about alternative methods.
@hundreds-father-404: the workaround worked, yea? i’ll probably look at this tomorrow morning.
h
I just rm -rfed .pids, and it worked fine
w
k, thanks. i do want to fix this though… i don’t like the hack.
👍 1