CalledProcessError git commit -F /tmp
aidiss opened this issue · 6 comments
aidiss commented
- bump-my-version version: 0.23.0
- Python version: 3.10
- Operating System: Linux
Description
Trying to bump version, with commit enabled.
Getting strange error message about git trying to commit some tmp file. No more info provided.
What I Did
$ bump-my-version bump $BUMP_TYPE --verbose
Starting BumpVersion 0.23.0
Reading configuration
...
Failed to run ['git', 'commit', '-F', '/tmp/tmpbl8vme_1']: return code 128,
output: b''
Committing to Git with message 'Bump version: 1.1.26 → 1.1.27'
Failed to run ['git', 'commit', '-F', '/tmp/tmpbl8vme_1']: return code 128,
output: b''
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /usr/local/lib/python3.10/site-packages/bumpversion/scm.py:74 in commit │
│ │
│ 71 │ │ │
│ 72 │ │ try: │
│ 73 │ │ │ cmd = [*cls._COMMIT_COMMAND, f.name, *extra_args] │
│ ❱ 74 │ │ │ subprocess.run(cmd, env=env, capture_output=True, check=Tr │
│ 75 │ │ except (subprocess.CalledProcessError, TypeError) as exc: # p │
│ 76 │ │ │ if isinstance(exc, TypeError): │
│ 77 │ │ │ │ err_msg = f"Failed to run {cls._COMMIT_COMMAND}: {exc} │
│ │
│ /usr/lib64/python3.10/subprocess.py:526 in run │
│ │
│ 523 │ │ │ raise │
│ 524 │ │ retcode = process.poll() │
│ 525 │ │ if check and retcode: │
│ ❱ 526 │ │ │ raise CalledProcessError(retcode, process.args, │
│ 527 │ │ │ │ │ │ │ │ │ output=stdout, stderr=stderr) │
│ 528 │ return CompletedProcess(process.args, retcode, stdout, stderr) │
│ 529 │
╰──────────────────────────────────────────────────────────────────────────────╯
CalledProcessError: Command '['git', 'commit', '-F', '/tmp/tmpbl8vme_1']'
returned non-zero exit status 128.
Usage: bump-my-version bump [OPTIONS] [ARGS]...
Try 'bump-my-version bump -h' for help
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ Failed to run ['git', 'commit', '-F', '/tmp/tmpbl8vme_1']: return code 128, │
│ output: b'' │
╰──────────────────────────────────────────────────────────────────────────────╯
coordt commented
@aidiss Let me first thank you for providing such a complete error report! I'll look into it today.
coordt commented
Version 0.24.0 improves the reporting of errors from git commands. Can you try this version? The underlying issue is from git, and is somewhat difficult to debug.
Let me know what the new results are.
aidiss commented
Here is 0.24.0 error:
subprocess.CalledProcessError: Command '['git', 'commit', '-F', '/tmp/tmp6d4i_ucn']' returned non-zero exit status 128.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/bump-my-version", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.10/site-packages/rich_click/rich_command.py", line 367, in __call__
return super().__call__(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/rich_click/rich_command.py", line 152, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/bumpversion/cli.py", line 309, in bump
do_bump(version_part, new_version, config, found_config_file, dry_run)
File "/usr/local/lib/python3.10/site-packages/bumpversion/bump.py", line 112, in do_bump
commit_and_tag(config, config_file, configured_files, ctx, dry_run)
File "/usr/local/lib/python3.10/site-packages/bumpversion/bump.py", line 142, in commit_and_tag
config.scm_info.tool.commit_to_scm(list(commit_files), config, ctx, extra_args, dry_run)
File "/usr/local/lib/python3.10/site-packages/bumpversion/scm.py", line 179, in commit_to_scm
cls.commit(
File "/usr/local/lib/python3.10/site-packages/bumpversion/scm.py", line 79, in commit
output = "\n".join([x for x in [exc.stdout, exc.stderr] if x])
TypeError: sequence item 0: expected str instance, bytes found
coordt commented
SIGH Work too fast and make stupid mistakes. 0.24.1 has a test for and fixes that error. Try again with 0.24.1
aidiss commented
The issue was not having git user and email configured.
Now error message got transparante and is working fine.
Thank you!