U
    Qh                     @  sR   d Z ddlmZ ddlZddlZdddddZdd	d
dZdddddZdS )zjGit utilities, adopted from mypy's git utilities (https://github.com/python/mypy/blob/master/mypy/git.py).    )annotationsNstrbool)dirreturnc                 C  s   t jt j| dS )z3Is the given directory version-controlled with git?z.git)ospathexistsjoinr    r   =./venv/lib/python3.8/site-packages/pydantic/_internal/_git.pyis_git_repo	   s    r   )r   c                   C  sF   zt ddg W dS  t jk
r,   Y dS  tk
r@   Y dS X dS )zCan we run the git executable?gitz--helpTFN)
subprocesscheck_outputZCalledProcessErrorOSErrorr   r   r   r   have_git   s    r   c                 C  s    t jddddg| dd S )z.Get the SHA-1 of the HEAD of a git repository.r   z	rev-parsez--shortZHEAD)cwdzutf-8)r   r   decodestripr   r   r   r   git_revision   s    r   )__doc__Z
__future__r   r   r   r   r   r   r   r   r   r   <module>   s   