
    g                         d gZ ddlmZmZ ddlmZmZ ddlmZm	Z	m
Z
mZmZmZ ddlmZmZmZ erddlmZ de	d	ef   d
e	d	ef   fdZ G d d eee      Zy)	Reference    )IterableObj	LazyMixin   )SymbolicReferenceT_References)AnyCallableIteratorTYPE_CHECKINGTypeUnion)AnyGitObjectPathLike_T)Repofunc.returnc                 Z     dt         dt        dt        f fd} j                  |_        |S )zZA decorator raising :exc:`ValueError` if we are not a valid remote, based on the
    path.selfargsr   c                 f    | j                         st        d| j                  z         | g| S )Nz1ref path does not point to a remote reference: %s)	is_remote
ValueErrorpath)r   r   r   s     G/var/www/openai/venv/lib/python3.12/site-packages/git/refs/reference.pywrapperz(require_remote_ref_path.<locals>.wrapper   s5    ~~PSWS\S\\]]D 4      )r   r	   r   __name__)r   r   s   ` r   require_remote_ref_pathr       s0    !l !3 !2 ! }}GNr   c                       e Zd ZdZdZdZdZdZdddded	e	d
df fdZ
d
efdZ	 ddeedef   deedf   d
d f fdZed
efd       Ze	 ddee   dddeedf   deded
ee   fd       Zeed
efd              Zeed
efd              Z xZS )r   zA named reference to any object.

    Subclasses may apply restrictions though, e.g., a :class:`~git.refs.head.Head` can
    only point to commits.
     FTrefsrepor   r   
check_pathr   Nc                     |rLt        |      j                  | j                  dz         s%t        d| j                  j
                  d|       |  t        |   ||       y)a  Initialize this instance.

        :param repo:
            Our parent repository.

        :param path:
            Path relative to the ``.git/`` directory pointing to the ref in question,
            e.g. ``refs/heads/master``.

        :param check_path:
            If ``False``, you can provide any path.
            Otherwise the path must start with the default path prefix of this type.
        /zCannot instantiate z from path N)str
startswith_common_path_defaultr   	__class__r   super__init__)r   r$   r   r%   r+   s       r   r-   zReference.__init__6   s\     c$i2243L3Ls3RS24>>3J3J2M[Y]X^_``t$r   c                     | j                   S N)name)r   s    r   __str__zReference.__str__I   s    yyr   objectr   logmsgc                    d}|G| j                   j                  }|j                  s%|j                  | k(  r| j                  j
                  }t        |   ||       |&| j                   j                  j                  ||       | S )zqSpecial version which checks if the head-log needs an update as well.

        :return:
            self
        N)	r$   headis_detachedrefcommitbinshar,   
set_object
log_append)r   r2   r3   	oldbinshar5   r+   s        r   r:   zReference.set_objectO   sx     	99>>D##D(8 KK..	 	66*  IINN%%i8 r   c                     | j                   j                  d      }t        |      dk  r| j                   S dj                  |dd       S )zi
        :return:
            (shortest) Name of this reference - it may contain path components
        r'         N)r   splitlenjoinr   tokenss     r   r0   zReference.namex   s@     %v;?99xxqr
##r   clscommon_pathr   kwargsc                 &    | j                  ||      S )zEquivalent to
        :meth:`SymbolicReference.iter_items <git.refs.symbolic.SymbolicReference.iter_items>`,
        but will return non-detached references as well.)_iter_items)rE   r$   rF   r   rG   s        r   
iter_itemszReference.iter_items   s     t[11r   c                 B    | j                   j                  d      }|d   S )z
        :return:
            Name of the remote we are a reference of, such as ``origin`` for a reference
            named ``origin/master``.
        r'   r?   )r   r@   rC   s     r   remote_namezReference.remote_name   s      %ayr   c                 `    | j                   j                  d      }dj                  |dd       S )z
        :return:
            Name of the remote head itself, e.g. ``master``.

        :note:
            The returned name is usually not qualified enough to uniquely identify a
            branch.
        r'   r>   N)r   r@   rB   rC   s     r   remote_headzReference.remote_head   s+     %xxqr
##r   )Tr/   )r   
__module____qualname____doc__	__slots___points_to_commits_only_resolve_ref_on_creater*   r   boolr-   r(   r1   r   r   r:   propertyr0   classmethodr   r   r	   r   rJ   r    rL   rN   __classcell__)r+   s   @r   r   r   )   sQ    I#!!%V %8 % %QU %&  $(%l$7<=% c4i % 
	%R 
$c 
$ 
$  .2
2,
2
2 8T>*
2 	
2
 
2 
,	
2 
2  S    
$S 
$  
$r   N)__all__git.utilr   r   symbolicr   r   typingr	   r
   r   r   r   r   	git.typesr   r   r   git.repor   r    r   r"   r   r   <module>r_      sa    - + 5 G F 0 0(37"3 b8I "E$!9k E$r   