a
    “˜ëj)  ã                   @  sV   d Z ddlmZ ddlZddlm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)ÚPathr   Úbool)ÚdirÚreturnc                 C  s   |   d¡ ¡ S )z3Is the given directory version-controlled with git?z.git)ÚjoinpathÚexists©r   © r
   úV/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pydantic/_internal/_git.pyÚis_git_repo	   s    r   )r   c                   C  sB   zt  ddg¡ W dS  t jy*   Y dS  ty<   Y dS 0 dS )zCan we run the git executable?Úgitz--helpTFN)Ú
subprocessÚcheck_outputÚCalledProcessErrorÚOSErrorr
   r
   r
   r   Úhave_git   s    r   Ústrc                 C  s   t jg d¢| d� d¡ ¡ S )z.Get the SHA-1 of the HEAD of a git repository.)r   z	rev-parsez--shortÚHEAD)Úcwdzutf-8)r   r   ÚdecodeÚstripr	   r
   r
   r   Úgit_revision   s    r   )	Ú__doc__Ú
__future__r   r   Úpathlibr   r   r   r   r
   r
   r
   r   Ú<module>   s   