Is there any way to get more detailed git errors? ...
# general
Is there any way to get more detailed git errors? I am trying to use
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?
Based on priors - likely shallow clone issue?
Does that jive with your CI setup maybe?
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
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/", 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 <> for common issues.
Consider reaching out for 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:
we are still using master as our default branch. yeah I am not seeing the stderr on failure
Ok, you should get useful stderr then by running that git command directly in CI.
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
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.
maybe just add something about needing the base_ref in your CI?
I finally got back around to fixing up the git stderr swallowing here: