Skip to content

Commit d1c180b

Browse files
committed
Fixed normalized paths in is_subpath
1 parent 4e993ed commit d1c180b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

bumpversion/bump.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ def commit_and_tag(
136136
137137
Args:
138138
config: The configuration
139-
config_file: The configuration file to include in the commit, if it exists
139+
config_file: The configuration file to include in the commit if it exists
140140
configured_files: A list of files to commit
141141
ctx: The context used to render the tag and tag message
142142
dry_run: True if the operation should be a dry run
143143
"""
144-
if not config.scm_info or not config.scm_info.tool:
144+
if not config.scm_info or not config.scm_info.tool: # pragma: no-coverage
145145
return
146146

147147
commit_files = {f.file_change.filename for f in configured_files}

bumpversion/utils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,8 @@ def run_command(command: list, env: Optional[dict] = None) -> CompletedProcess:
131131

132132
def is_subpath(parent: Path | str, path: Path | str) -> bool:
133133
"""Return whether a path is inside the parent."""
134-
return str(path).startswith(str(parent)) if Path(path).is_absolute() else True
134+
normalized_parent = Path(parent).resolve()
135+
normalized_path = Path(path).resolve()
136+
print(f"normalized_parent: {normalized_parent}")
137+
print(f"normalized_path: {normalized_path}")
138+
return str(normalized_path).startswith(str(normalized_parent)) if normalized_path.is_absolute() else True

0 commit comments

Comments
 (0)