(wd: Optional[str] = None)
Check if folder is git directory.
Check if folder is git directory.
Check if folder is git directory .
def check_git_dir(wd: Optional[str] = None) -> None:
    """Check if folder is git directory."""
    check_git_installed()

    cmd = [GIT_PATH]
    if wd is not None:
        cmd.extend(("-C", wd))

    cmd.append("status")
    with subprocess.Popen(
        cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
    ) as process:
        if process.wait():
            raise click.ClickException("Not a git directory.")
def check_git_dir ( wd : Optional [ str ] = None ) -> None : check_git_installed ( ) cmd = [ GIT_PATH ] if wd is not None : cmd . extend ( ( "-C" , wd ) ) cmd . append ( "status" ) with subprocess . Popen ( cmd , stdout = subprocess . DEVNULL , stderr = subprocess . DEVNULL ) as process : if process . wait ( ) : raise click . ClickException ( "Not a git directory." )