Skip to content

Commit 9fa12c0

Browse files
committed
refactor(utils): convert git project root to posix path for backup file name
1 parent dc11f8b commit 9fa12c0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

commitizen/cz/utils.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ def strip_local_version(version: str) -> str:
2121

2222

2323
def get_backup_file_path() -> str:
24+
project_root = git.find_git_project_root()
25+
26+
if project_root is None:
27+
project = ""
28+
else:
29+
project = project_root.as_posix().replace("/", "%")
30+
2431
return os.path.join(
2532
tempfile.gettempdir(),
26-
"cz.commit%{user}%{project_root}.backup".format(
33+
"cz.commit%{user}%{project}.backup".format(
2734
user=os.environ.get("USER", ""),
28-
project_root=str(git.find_git_project_root()).replace("/", "%"),
35+
project=project,
2936
),
3037
)

0 commit comments

Comments
 (0)