o
    2g                     @  sL   d Z ddlmZ ddlZddlZddd	Zdd
dZdddZdddZdS )zGit utilities.    )annotationsNdirstrreturnboolc                 C  s   t jt j| dS )z3Is the given directory version-controlled with git?z.git)ospathexistsjoinr    r   @/home/garg/my-data/venv/lib/python3.10/site-packages/mypy/git.pyis_git_repo
      r   c                   C  s>   z
t ddg W dS  t jy   Y dS  ty   Y dS w )zCan we run the git executable?gitz--helpTF)
subprocesscheck_outputCalledProcessErrorOSErrorr   r   r   r   have_git   s   r   bytesc                 C  s   t jg d| d S )z.Get the SHA-1 of the HEAD of a git repository.)r   z	rev-parseHEADcwdr   r   stripr   r   r   r   git_revision   r   r   c                 C  s   t jg d| d}| dkS )z7Check whether a git repository has uncommitted changes.)r   statusz-unoz--porcelainr       r   )r   outputr   r   r   is_dirty   s   r    )r   r   r   r   )r   r   )r   r   r   r   )	__doc__
__future__r   r   r   r   r   r   r    r   r   r   r   <module>   s    


