Skip to content

Commit 24909fd

Browse files
committed
fix(git): remove breakline in the return value of find_git_project_root
1 parent 421c89f commit 24909fd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

commitizen/git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ def get_all_tags() -> Optional[List[str]]:
6060

6161
def find_git_project_root() -> Path:
6262
c = cmd.run("git rev-parse --show-toplevel")
63-
return Path(c.out)
63+
return Path(c.out.strip())

tests/test_conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
2+
from pathlib import Path
23

34
import pytest
45

5-
from commitizen import config, defaults
6+
from commitizen import config, defaults, git
7+
68

79
PYPROJECT = """
810
[tool.commitizen]
@@ -126,3 +128,7 @@ def test_set_key(configure_supported_files, config_files_manager):
126128
_conf.set_key("version", "2.0.0")
127129
cfg = config.read_cfg()
128130
assert cfg.settings == _new_settings
131+
132+
133+
def test_find_git_project_root():
134+
assert git.find_git_project_root() == Path(os.getcwd())

0 commit comments

Comments
 (0)