Ë
    ùmxiç"  ã                   óœ  — d Z g d¢ZddlmZ ddlmZmZ ddlmZm	Z	m
Z
mZmZmZmZmZ erddlmZ ddlmZ eeeef   Zeedf   Zd	ee   d
edgeedf   f   ddfd„Zdede	e   fd„Zde
e   dedededef
d„Zedddeddfd„«       Zedededefd„«       Zdededefd„Zdddeeedf      dede	eedf      fd„Zdddedede	e   fd „Zy)!z6Functions that are supposed to be as fast as possible.)Útree_to_streamÚtree_entries_from_dataÚtraverse_trees_recursiveÚtraverse_tree_recursiveé    )ÚS_ISDIR)Úsafe_decodeÚdefenc)ÚCallableÚListÚMutableSequenceÚSequenceÚTupleÚTYPE_CHECKINGÚUnionÚoverload)ÚReadableBuffer)ÚGitCmdObjectDBNÚentriesÚwriter   Úreturnc           
      ó0  — t        d«      }d}| D ]„  \  }}}d}t        d«      D ]  }t        ||dz  z	  |z  |z   g«      |z   }Œ |d   |k(  r|dd }t        |t        «      r|j                  t        «      }	n|}	 |dj                  |d	|	d
|f«      «       Œ† y)zéWrite the given list of entries into a stream using its ``write`` method.

    :param entries:
        **Sorted** list of tuples with (binsha, mode, name).

    :param write:
        A ``write`` method which takes a data string.
    Ú0é   ó    é   é   r   é   Nó    ó    )ÚordÚrangeÚbytesÚ
isinstanceÚstrÚencoder	   Újoin)
r   r   Úord_zeroÚbit_maskÚbinshaÚmodeÚnameÚmode_strÚiÚ
name_bytess
             úF/home/htdocs/ttos/venv/lib/python3.12/site-packages/git/objects/fun.pyr   r   )   s¼   € ô �3‹x€HØ€Hà%ò EÑˆ��dØˆÜ�q“ò 	UˆAÜ ¨¨Q©¡°8Ñ;¸xÑGÐHÓIÈHÑT‰Hð	Uð
 �A‰;˜(Ò"Ø  �|ˆHô �dœCÔ ØŸ™¤VÓ,‰JàˆJÙˆc�h‰h˜ $¨
°E¸6ÐBÓCÕDñ)Er   Údatac                 óX  — t        d«      }t        d«      }t        | «      }d}g }||k  rd}| |   |k7  r|dz  | |   |z
  z   }|dz  }| |   |k7  rŒ|dz  }|}| |   dk7  r|dz  }| |   dk7  rŒ| || }t        |«      }	|dz  }| ||dz    }
|dz   }|j                  |
||	f«       ||k  rŒ|S )z÷Read the binary representation of a tree and returns tuples of
    :class:`~git.objects.tree.Tree` items.

    :param data:
        Data block with tree data (as bytes).

    :return:
        list(tuple(binsha, mode, tree_relative_path), ...)
    r   ú r   r   r   é   )r    Úlenr   Úappend)r0   r'   Ú	space_ordÚlen_datar-   Úoutr*   Únsr.   r+   Úshas              r/   r   r   M   s  € ô �3‹x€HÜ�C“€IÜ�4‹y€HØ	€AØ
€CØ
ˆhŠ,Øˆð
 �1‰g˜Ò"ð ˜A‘I $ q¡'¨HÑ"4Ñ5ˆDØ�‰FˆAð	 �1‰g˜Ó"ð 	
ˆQ‰ˆð ˆØ�1‰g˜ŠlØ�‰FˆAð �1‰g˜‹lð ˜"˜Q�Zˆ
Ü˜:Ó&ˆð 	
ˆQ‰ˆØ�1�q˜2‘vÐˆØ�‰FˆØ�
‰
�C˜˜tÐ$Ô%ðA ˆh‹,ðD €Jr   Ú	tree_datar+   Úis_dirÚstart_atc                 óä   — 	 | |   }|r |d   |k(  rt        |d   «      |k(  rd| |<   |S t        | «      D ]+  \  }}|sŒ	|d   |k(  sŒt        |d   «      |k(  sŒ$d| |<   |c S  y# t        $ r Y ŒEw xY w)z½Return data entry matching the given name and tree mode or ``None``.

    Before the item is returned, the respective data item is set None in the `tree_data`
    list to mark it done.
    é   r   N)r   Ú
IndexErrorÚ	enumerate)r;   r+   r<   r=   ÚitemÚindexs         r/   Ú_find_by_namerD   �   sœ   € ðØ˜Ñ"ˆÙ�D˜‘G˜t’O¬°°Q±Ó(8¸FÒ(BØ"&ˆI�hÑØˆKô ! Ó+ò ‰ˆˆtÚ�D˜‘G˜t“O¬°°Q±Ó(8¸FÓ(BØ#ˆI�eÑØŠKðð øô ò Ùðús   ‚&A# Á#	A/Á.A/rB   Úpath_prefixc                  ó   — y ©N© ©rB   rE   s     r/   Ú_to_full_pathrJ   ™   s   € Ø9<r   c                  ó   — y rG   rH   rI   s     r/   rJ   rJ   �   s   € ØADr   c                 ó,   — | s| S | d   | d   || d   z   fS )z%Rebuild entry with given path prefix.r   r   r?   rH   rI   s     r/   rJ   rJ   ¡   s(   € áØˆØ�‰G�T˜!‘W˜k¨D°©GÑ3Ð4Ð4r   Úodbr   Ú	tree_shas.c                 óº  ‡— g }t        |«      }|D ]I  }|€g }n1t        t        | j                  |«      j	                  «       «      «      }|j                  |«       ŒK g }t        |«      D ]ä  \  }}	t        |	«      D ]Ì  \  }
}|sŒ	t        |«      D �cg c]  }d‘Œ }}|||<   |\  }}}t        |«      }t        |dz   ||z   «      D ]  }||z  }t        ||   |||
«      ||<   Œ |r<|j                  t        | |D �cg c]  }|xr |d   xs d‘Œ c}‰|z   dz   «      «       n#|j                  t        ˆfd„|D «       «      «       d|	|
<   ŒÎ |	dd…= Œæ |S c c}w c c}w )a%  
    :return:
        List of list with entries according to the given binary tree-shas.

        The result is encoded in a list
        of n tuple|None per blob/commit, (n == len(tree_shas)), where:

        * [0] == 20 byte sha
        * [1] == mode as int
        * [2] == path relative to working tree root

        The entry tuple is ``None`` if the respective blob/commit did not exist in the
        given tree.

    :param tree_shas:
        Iterable of shas pointing to trees. All trees must be on the same level.
        A tree-sha may be ``None``, in which case ``None``.

    :param path_prefix:
        A prefix to be added to the returned paths on this level.
        Set it ``""`` for the first iteration.

    :note:
        The ordering of the returned items will be partially lost.
    Nr   r   ú/c              3   ó6   •K  — | ]  }t        |‰«      –— Œ y ­wrG   )rJ   )Ú.0ÚerE   s     €r/   ú	<genexpr>z+traverse_trees_recursive.<locals>.<genexpr>ó   s   øè ø€ Ò PÀ1¤¨q°+×!>Ñ Pùs   ƒ)r4   Úlistr   ÚstreamÚreadr5   rA   r!   r   rD   Úextendr   Útuple)rM   rN   rE   Ú
trees_dataÚntÚtree_shar0   r8   Útir;   ÚiirB   Ú_r   Ú_shar*   r+   r<   ÚtioÚeis     `                 r/   r   r   ¨   s£  ø€ ð8 .0€Jä	ˆY‹€BØò  ˆØÐØ)+‰Dô Ô.¨s¯z©z¸(Ó/C×/HÑ/HÓ/JÓKÓLˆDà×Ñ˜$Õð ð -/€Cô
 # :Ó.ò %‰ˆˆIÜ! )Ó,ò  	!‰HˆB�ÙØô &+¨2£YÖ/ ’tÐ/ˆGÐ/ØˆG�B‰KØ#ÑˆD�$˜Ü˜T“]ˆFô
 ˜R !™V R¨"¡WÓ-ò P�Ø˜B‘h�Ü,¨Z¸©_¸dÀFÈBÓO�˜’ðPñ Ø—
‘
Ü,ØØ<CÖD°b˜2š< " Q¡%Ò0¨DÑ0ÒDØ# dÑ*¨SÑ0óõð —
‘
œ5Ó PÈÔ PÓPÔQð !ˆI�bŠMðA 	!ðH ’a‰LðK%ðN €JùòC 0ùò$ Es   Â	EÃ9Er\   c           	      óú   — g }t        | j                  |«      j                  «       «      }|D ]K  \  }}}t        |«      r#|j	                  t        | |||z   dz   «      «       Œ5|j                  ||||z   f«       ŒM |S )aA  
    :return:
        List of entries of the tree pointed to by the binary `tree_sha`.

        An entry has the following format:

        * [0] 20 byte sha
        * [1] mode as int
        * [2] path relative to the repository

    :param path_prefix:
        Prefix to prepend to the front of all returned paths.
    rP   )r   rV   rW   r   rX   r   r5   )rM   r\   rE   r   r0   r:   r*   r+   s           r/   r   r      sƒ   € ð €GÜ! #§*¡*¨XÓ"6×";Ñ";Ó"=Ó>€Dð  ò <‰ˆˆT�4Ü�4Œ=Ø�N‰NÔ2°3¸¸[È4Ñ=OÐRUÑ=UÓVÕWà�N‰N˜C  {°TÑ'9Ð:Õ;ð	<ð €Nr   ) Ú__doc__Ú__all__Ústatr   Ú
git.compatr   r	   Útypingr
   r   r   r   r   r   r   r   Ú	_typeshedr   Úgitr   r"   Úintr$   ÚEntryTupÚEntryTupOrNoner   r   ÚboolrD   rJ   r   r   rH   r   r/   ú<module>ro      s£  ðñ =ò€õ ç *÷	÷ 	ó 	ñ Ý(å"à�˜˜S�Ñ!€Ø�x �~Ñ&€ð
 E˜H XÑ.ð  E°xÐAQÐ@RÐTYÐZ]Ð_cÐZcÑTdÐ@dÑ7eð  EÐjnó  EðH1 ð 1¨4°©>ó 1ðh˜_¨^Ñ<ð ÀCð ÐQUð Ðadð Ðiwó ð0 
Ø <˜Ð <¨3Ð <°4Ò <ó 
Ø <ð 
Ø D˜Ð D¨sÐ D°xÒ Dó 
Ø Dð5˜ð 5°Sð 5¸^ó 5ðUØ	ðUØ&.¨u°U¸D°[Ñ/AÑ&BðUØQTðUà	ˆ%� Ð#Ñ
$Ñ%óUðpÐ!1ð ¸Uð ÐQTð ÐY]Ð^fÑYgô r   