
    %^g                    D    d Z ddlmZ ddlZddlZddZd	dZd
dZddZy)zGit utilities.    )annotationsNc                |    t         j                  j                  t         j                  j                  | d            S )z3Is the given directory version-controlled with git?z.git)ospathexistsjoindirs    (lib/python3.12/site-packages/mypy/git.pyis_git_repor   
   s$    77>>"'',,sF344    c                 z    	 t        j                  ddg       y# t         j                  $ r Y yt        $ r Y yw xY w)zCan we run the git executable?gitz--helpTF)
subprocesscheck_outputCalledProcessErrorOSError r   r   have_gitr      s@     12((  s    :::c                P    t        j                  g d|       j                         S )z.Get the SHA-1 of the HEAD of a git repository.)r   z	rev-parseHEADcwdr   r   stripr	   s    r   git_revisionr      s    ""#?SIOOQQr   c                Z    t        j                  g d|       }|j                         dk7  S )z7Check whether a git repository has uncommitted changes.)r   statusz-unoz--porcelainr   r   r   )r
   outputs     r   is_dirtyr       s'    $$%MSVWF<<>S  r   )r
   strreturnbool)r"   r#   )r
   r!   r"   bytes)	__doc__
__future__r   r   r   r   r   r   r    r   r   r   <module>r'      s(     # 	 5
R
!r   