https://pantsbuild.org/ logo
#general
Title
# general
f

flat-zoo-31952

08/04/2022, 9:23 PM
I'm trying
./pants tailor --changed-since=HEAD
as a pre-commit check, and it's adding things for unstaged files... is there a way to spell the index in a
--changed-diffspec=
so that this doesn't happen?
1
h

hundreds-father-404

08/04/2022, 9:25 PM
f

flat-zoo-31952

08/04/2022, 9:34 PM
I mean.. yeah that's what i'm going for... I want be able to say the equivalent of
Copy code
./pants --changed-diffspec=HEAD...<staged> tailor
I don't know if there's a way to express '<staged>' in spelling revisions though
i know that I could do
Copy code
git diff --cached --name-only --no-commit-id HEAD
er... I guess I could do this only on push and then I could just do
--changed-since=HEAD
h

hundreds-father-404

08/04/2022, 9:37 PM
One option is to try something like
./pants --spec-files=<(git diff-tree --cached --name-only --no-commit-id HEAD) list
. Although you may hit https://github.com/pantsbuild/pants/issues/5385 on bash
f

flat-zoo-31952

08/04/2022, 9:37 PM
I tried that... it doesn't work for tailor specifically because pants wont
list
things it hasn't been told to pay attention to yet
h

hundreds-father-404

08/04/2022, 9:38 PM
what Pants version is this? In Pants 2.13,
tailor
learned how to work on file arguments regardless of targets existing or not 🙂
f

flat-zoo-31952

08/04/2022, 9:44 PM
2.13rc0
h

hundreds-father-404

08/04/2022, 9:45 PM
hm, I'm not following then why this would be relevant?
it doesn't work for tailor specifically because pants wont list things it hasn't been told to pay attention to yet
In the code snippet, use
tailor
rather than
list
. That should feed Pants a bunch of (possibly unowned) files, and it should know what to do
f

flat-zoo-31952

08/04/2022, 9:48 PM
oh, have to change the deprecated directory semantics thing
👍 1
ah so I can just set pre-commit up to pass the filenames
1
7 Views