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

loud-laptop-17949

10/28/2021, 5:15 PM
Is there any way to get more detailed git errors? I am trying to use
--changed-since
in our CI system and and get this error
Copy code
Error: 6.70 [ERROR] git --git-dir=/home/runner/work/color/color/.git --work-tree=/home/runner/work/color/color diff --name-only master...HEAD -- /home/runner/work/color/color failed with exit code 128
. Not sure how to debug this further without a more detailed error message?
e

enough-analyst-54434

10/28/2021, 5:16 PM
Based on priors - likely shallow clone issue?
Does that jive with your CI setup maybe?
l

loud-laptop-17949

10/28/2021, 5:17 PM
yeah I thought that, but added
fetch-depth: 0
in this github action. Also do a `git fetch origin
${{ gitbhub.base_ref }}
to make sure that reference is there
e

enough-analyst-54434

10/28/2021, 5:18 PM
Ok. The debug would be adding an early step in CI that just ran that command directly with any extra verbosity you want passed to git directly.
Presumably though, a master ref does not exist. I'm not sure a HEAD ref can ever not exist.
Did you folks do a master -> main switch?
Ok, for example, I get:
Copy code
$ ./pants --changed-since=upstream/main fmt lint check test
...
  File "/home/jsirois/dev/pantsbuild/pants/src/python/pants/vcs/git.py", line 82, in _check_result
    raise GitException(failure_msg or f"{cmd_str} failed with exit code {result}")
pants.vcs.git.GitException: git --git-dir=/home/jsirois/dev/pantsbuild/pants/.git --work-tree=/home/jsirois/dev/pantsbuild/pants diff --name-only upstream/main...HEAD -- /home/jsirois/dev/pantsbuild/pants failed with exit code 128

Use -ldebug for more logs. 
See <https://www.pantsbuild.org/v2.8/docs/troubleshooting> for common issues.
Consider reaching out for help: <https://www.pantsbuild.org/v2.8/docs/getting-help>
Just like you. And that's horrible. Running the command line bare I get:
Copy code
$ git --git-dir=/home/jsirois/dev/pantsbuild/pants/.git --work-tree=/home/jsirois/dev/pantsbuild/pants diff --name-only upstream/main...HEAD -- /home/jsirois/dev/pantsbuild/pants
fatal: bad revision 'upstream/main...HEAD'
Which is better - I'm working in a clone with just an origin remote and no upstream remote. We should be outputting the stderr of the failure: https://github.com/pantsbuild/pants/issues/13396
l

loud-laptop-17949

10/28/2021, 5:50 PM
we are still using master as our default branch. yeah I am not seeing the stderr on failure
e

enough-analyst-54434

10/28/2021, 5:57 PM
Ok, you should get useful stderr then by running that git command directly in CI.
l

loud-laptop-17949

10/28/2021, 6:22 PM
yeah I am now. trying to figure out the right set of git incantations to make this work
for those at home, I needed to run
git fetch origin master:master
to get a reference there
👍 1
b

busy-vase-39202

10/28/2021, 7:40 PM
Thanks for following up with a solution @loud-laptop-17949. Can you suggest how to improve the docs and/or code so others don't fall into the same hole? Someone else experienced a similar problem yesterday.
l

loud-laptop-17949

10/28/2021, 9:06 PM
maybe just add something about needing the base_ref in your CI?
e

enough-analyst-54434

11/15/2021, 6:24 PM
I finally got back around to fixing up the git stderr swallowing here: https://github.com/pantsbuild/pants/pull/13626
l

loud-laptop-17949

11/15/2021, 7:14 PM
👍
7 Views