Skip to content

Commit 5ffc9df

Browse files
committed
feat(git): add find_git_project_root
#117
1 parent d6ccf55 commit 5ffc9df

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

commitizen/git.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from pathlib import Path
23
from tempfile import NamedTemporaryFile
34
from typing import Optional, List
45

@@ -55,3 +56,8 @@ def get_all_tags() -> Optional[List[str]]:
5556
if c.err:
5657
return []
5758
return [tag.strip() for tag in c.out.split("\n") if tag.strip()]
59+
60+
61+
def find_git_project_root() -> Path:
62+
c = cmd.run("git rev-parse --show-toplevel")
63+
return Path(c.out)

0 commit comments

Comments
 (0)