https://pantsbuild.org/ logo
h

hundreds-father-404

05/11/2020, 8:19 PM
--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

hundreds-breakfast-49010

05/11/2020, 8:21 PM
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

hundreds-father-404

05/11/2020, 8:22 PM
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

hundreds-breakfast-49010

05/11/2020, 8:33 PM
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

hundreds-father-404

05/11/2020, 8:33 PM
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

witty-crayon-22786

05/11/2020, 8:38 PM
.pids
is intentionally included
h

hundreds-father-404

05/11/2020, 8:38 PM
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

witty-crayon-22786

05/11/2020, 8:38 PM
…oh. hm.
h

hundreds-father-404

05/11/2020, 8:39 PM
This is running
./pants cloc '**'
in the example repo
happens in master too
w

witty-crayon-22786

05/11/2020, 8:40 PM
it should only happen if you’ve used watchman (ie, used pantsd before this release)… although that’s not ideal
🤔 1
h

hundreds-father-404

05/11/2020, 8:40 PM
No matter what I do, .demo/f.py is ignored
This is because of the default ignore of hidden files. Okay.
w

witty-crayon-22786

05/11/2020, 8:41 PM
i think there is a quick fix though… can switch the hole we punch to be pantsd specific. sorry about that.
👍 1
h

hundreds-father-404

05/11/2020, 8:41 PM
Cool. Thanks. @hundreds-breakfast-49010 it looks like
--pants-ignore
is in fact behaving properly. Sorry for the false flag
👍 1
h

hundreds-breakfast-49010

05/11/2020, 8:43 PM
so the
.pids
directory is special-cased with @witty-crayon-22786’s recent change, before the gitignore-processing code?
w

witty-crayon-22786

05/11/2020, 8:43 PM
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

hundreds-father-404

05/11/2020, 9:00 PM
Thanks
w

witty-crayon-22786

05/11/2020, 11:22 PM
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

hundreds-father-404

05/11/2020, 11:23 PM
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

witty-crayon-22786

05/11/2020, 11:25 PM
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

hundreds-father-404

05/11/2020, 11:45 PM
I just rm -rfed .pids, and it worked fine
w

witty-crayon-22786

05/12/2020, 12:00 AM
k, thanks. i do want to fix this though… i don’t like the hack.
👍 1