Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

current_version not bumped in config when on a network mapped drive #253

Closed
tuomastik opened this issue Nov 13, 2024 · 5 comments · Fixed by #268
Closed

current_version not bumped in config when on a network mapped drive #253

tuomastik opened this issue Nov 13, 2024 · 5 comments · Fixed by #268

Comments

@tuomastik
Copy link

  • bump-my-version version: 0.27.0
  • Python version: 3.11.4
  • Operating System: Windows 10

Description

  • Trying to get done

    • Bump version by running bump-my-version bump minor in a Git repository that is located on a network mapped drive in Windows 10. It does not matter if bumping major/minor/patch.
  • What happened

    • The command did not produce errors and the version string was correctly bumped in every file listed in the config (.bumpversion.toml), but the current_version was not bumped in .bumpversion.toml.
  • Finding the cause

    • When running bump-my-version bump minor -vvv, one of the outputted lines showed "Configuration file is outside of the repo. Not going to change.". That message stems from update_config_file(). It lead me to run git rev-parse --show-toplevel to check my Git repository's root directory, which pointed to a different path than pwd due to my Git repository being located on a network mapped drive.
  • Workaround

    cd $(git rev-parse --show-toplevel)
    bump-my-version bump minor
@coordt
Copy link
Member

coordt commented Nov 14, 2024

I understand what you are seeing and why it happens. bump-my-version does not change configuration files that it detects are outside the repo because some people host the configuration in a central place.

It seems the method of detection should be improved.

I don't have the ability to re-create your scenario to test out different methods. Can you offer some ideas to determine if the configuration is within the git repo? I'm obviously just doing some basic path checking. Is there a better way?

@dornech
Copy link

dornech commented Dec 16, 2024

From my previous experience with python-semantic-release I wonder if this is caused by the issue that Windows paths are represented a) in the classic way with a drive letter or b) as UNC Path. To translate classic to UNC Representation somewhere a .resolve() could be missing.

@dornech
Copy link

dornech commented Dec 17, 2024

I can confirm the error and the root cause. generate-changlog accesses the file via the Path with a drive letter. git rev-parse --show-toplevel shows the UNC representation of the same path.

@dornech
Copy link

dornech commented Dec 17, 2024

try to change line 131 in bumpversion/config/files.py
old:
config_path = Path(config_file)
new:
config_path = Path(config_file).resolve()

@tuomastik
Copy link
Author

try to change line 131 in bumpversion/config/files.py old: config_path = Path(config_file) new: config_path = Path(config_file).resolve()

I confirm this fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants