MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / is_git_repository

Function is_git_repository

codewiki/cli/utils/repo_validator.py:136–149  ·  view source on GitHub ↗

Check if path is inside a git repository. Searches parent directories if .git is not directly at repo_path, supporting monorepo subdirectories. Args: repo_path: Path to check Returns: True if inside a git repository, False otherwise

(repo_path: Path)

Source from the content-addressed store, hash-verified

134def is_git_repository(repo_path: Path) -> bool:
135 """
136 Check if path is inside a git repository.
137
138 Searches parent directories if .git is not directly at repo_path,
139 supporting monorepo subdirectories.
140
141 Args:
142 repo_path: Path to check
143
144 Returns:
145 True if inside a git repository, False otherwise
146 """
147 return _get_git_repo(repo_path) is not None
148
149
150def get_git_commit_hash(repo_path: Path) -> str:
151 """
152 Get current git commit hash.

Callers 1

generate_commandFunction · 0.90

Calls 1

_get_git_repoFunction · 0.85

Tested by

no test coverage detected