callowayproject/bump-my-version

Support commit flag when running bump-my-version with an external config file

Closed this issue · 0 comments

  • bump-my-version version: 0.24.3
  • Python version: All
  • Operating System: All

Description

I have my configuration stored in an external bumpversion.toml file, so that I can use it across multiple repositories.
In these repositories, I run bump-my-version with --config-file=/path_to_external/bumpversion.toml.

What I Did

When I set the commit flag, bump-my-version tries to stage the external config file resulting in a git error.

For example:

bump-my-version bump patch pyproject.toml --config-file=/path_to_external/bumpversion.toml --commit --verbose

returns the following logs:

...
Processing config file: /path_to_external/bumpversion.toml                                                                        
Preparing Git commit                                                                                                                                                                          
  Adding changes in file '/path_to_external/bumpversion.toml' to Git                                                              
fatal: : /path_to_external/bumpversion.toml: ': /path_to_external/bumpversion.toml' is outside repository at '/path_to_repo'
...

Proposal

First check if a config file is outside the git repo before trying to stage it.