make git optional again
This commit is contained in:
@@ -13,9 +13,10 @@ def commit_file(
|
||||
repo_dir: Optional[Path] = None,
|
||||
commit_message: Optional[str] = None,
|
||||
) -> None:
|
||||
# set default for repo_dir
|
||||
if repo_dir is None:
|
||||
repo_dir = find_git_repo_root()
|
||||
if repo_dir is None:
|
||||
return
|
||||
# check that the file is in the git repository and exists
|
||||
if not Path(file_path).resolve().is_relative_to(repo_dir.resolve()):
|
||||
raise ClanError(f"File {file_path} is not in the git repository {repo_dir}")
|
||||
|
||||
Reference in New Issue
Block a user