ܶ= j d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZ dd lmZmZmZ dd
lmZmZ ddlmZ ddlmZ ddlmZmZmZmZ dd
l m!Z! er*ddl m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddlm)Z)m*Z*m+Z+m,Z, ddl-m.Z. dZ/d:dZ0d;dZ1dd'Z4 d?d@d.Z5dAd2Z6dBd6Z7dCd9Z8dS )Dz1Package with general repository related functions )annotationsN)Path)digits)WorkTreeRepositoryUnsupported)Object)SymbolicReference)
hex_to_bin
bin_to_hexcygpath) BadObjectBadName)Git)UnionOptionalcast
TYPE_CHECKING)
Commit_ish)PathLike )Repo)GitCmdObjectDB) Reference)Commit TagObjectBlobTree)Tag) rev_parse
is_git_dirtouchfind_submodule_git_dirname_to_object
short_to_long deref_tag to_commitfind_worktree_git_dirfilenamestrreturnc X t | d 5 d d d n# 1 swxY w Y | S )Nab)open)r' s ^/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/git/repo/fun.pyr r 0 so
h
Os ##d
'PathLike'boolc t j | rDt j t j | d sdt j v rt j t j | d rdt j | d }t j | p:t j | o&t j | d S t j t j | d r]t j t j | d r6t j t j | d rt | dS ) a{ This is taken from the git setup.c:is_git_directory
function.
@throws WorkTreeRepositoryUnsupported if it sees a worktree directory. It's quite hacky to do that here,
but at least clearly indicates that we don't support it.
There is the unlikely danger to throw if we see directories which just look like a worktree dir,
but are none.objectsGIT_OBJECT_DIRECTORYrefsHEADgitdir commondirgitfileF)
ospisdirjoinosenvironisfileislinkreadlink
startswithr )r. headrefs r- r r 6 s$ y|| 3Ichq),,--
31G2:1U1U[^[dHQ\
\
1U hq&))G:g&&k3:g+>+>+j2;wCWCWCbCbciCjCjkJsx8,,-- 3
38A{3344 3
38Ay1122 3
02225 dotgit
Optional[str]c L t j | }n# t $ r Y dS w xY wt j |j sdS t | }d |D D ]\ }}|dk r|c S n# t $ r Y nw xY wdS )z&Search for a gitdir for this worktree.Nc \ g | ])}| d *S )z: )stripsplit).0lines r-
z)find_worktree_git_dir..X s. FFF4::<<--d33FFFrC r6 ) r<