Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions git_commitflow/git_commitflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def __init__(self):
self.args = self._parse_args()

self.git_repo_dir = None
self.find_git_repo_dir()

self.git_repo_dir = None
self.find_git_repo_dir() # Update self.git_repo_dir

self.amount_commits = self.count_commits()
self.cache = CacheFile(CACHE_FILE)
Expand Down Expand Up @@ -285,7 +287,8 @@ def git_config_get(self, git_var: str, default_value: str = "") -> str:
def find_git_repo_dir(self):
try:
self.git_repo_dir = Path(
self._get_first_line_cmd("git rev-parse --show-toplevel")
self._get_first_line_cmd("git rev-parse --show-toplevel",
check=True)
)
except subprocess.CalledProcessError as proc_err:
print(f"Error: {proc_err}", file=sys.stderr)
Expand All @@ -299,8 +302,8 @@ def find_git_repo_dir(self):
def count_commits(self):
return len(self._run("git rev-list --all --count"))

def _get_first_line_cmd(self, cmd) -> str:
output = self._run(cmd)
def _get_first_line_cmd(self, cmd, **kwargs) -> str:
output = self._run(cmd, **kwargs)
try:
return output[0]
except IndexError:
Expand Down