Skip to content

Commit

Permalink
Debugging path_in_repo again !minor
Browse files Browse the repository at this point in the history
  • Loading branch information
coordt committed Jan 26, 2025
1 parent a2b7bd1 commit 015b425
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bumpversion/scm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ def _update_from_latest_tag_info(self, latest_tag_info: LatestTagInfo):

def path_in_repo(self, path: Path | str) -> bool:
"""Return whether a path is inside this repository."""
print(path, self.repository_root)
if self.repository_root is None:
return True
elif not Path(path).is_absolute():
return True
print(path, self.repository_root)
return str(path).startswith(str(self.repository_root))

def commit_and_tag(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scm/test_models_scminfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_function_logic_working(
full_test_path = test_path.format(tmp_path=tmp_path)
with inside_dir(tmp_path):
scm_info = SCMInfo(scm_config)
scm_info.repository_root = tmp_path.joinpath("repo/root")
scm_info.repository_root = tmp_path / "repo" / "root"

# Act
result = scm_info.path_in_repo(full_test_path)
Expand Down

0 comments on commit 015b425

Please sign in to comment.