python / cherry-picker

🐍🍒⛏ Utility script for backporting/cherry-picking CPython changes from master into one of the maintenance branches.
Apache License 2.0
46 stars 38 forks source link

Error message from git is hidden when a git command fails #100

Open gpshead opened 7 months ago

gpshead commented 7 months ago

running cherry_picker 2.2.0 for a 3.12 backport, I get subprocess.CalledProcessError: Command '['git', 'log', '--format=%H', '3.12..']' returned non-zero exit status 128. and nothing else.

I'm left to manually recreate that command line and run it myself to try and figure out what git's damage is. Running git I see fatal: ambiguous argument '3.12..': unknown revision or path not in the working tree. which is better at least, but still not wholly informative (of course it isn't, git is [censored])...

(the real source of my error is likely what shows up when I try this:)

$ git checkout 3.12
error: pathspec '3.12' did not match any file(s) known to git
hint: '3.12' matched more than one remote tracking branch.
...

When git fails, we should at least let git speak for itself (regardless of utility) and not swallow the git error output.