�
lMg� � �B � d dl Z d dlZd dlmZ ddlmZ G d� de� Zy)� N)�AbstractFileSystem� )�
MemoryFilec � � � e Zd ZdZdZdZd
� fd� Ze� fd�� Zd� Z e
d� � Ze
dd�� Zdd �Z
dd
�Zdd�Z dd�Z� xZS )�
GitFileSystemz\Browse the files of a local git repo at any hash/tag/branch
(experimental backend)
� Tc � �� t �| � di |�� t j |xs |xs t j
� � | _ |xs d| _ y)aM
Parameters
----------
path: str (optional)
Local location of the repo (uses current directory if not given).
May be deprecated in favour of ``fo``. When used with a higher
level function such as fsspec.open(), may be of the form
"git://[path-to-repo[:]][ref@]path/to/file" (but the actual
file path should not contain "@" or ":").
fo: str (optional)
Same as ``path``, but passed as part of a chained URL. This one
takes precedence if both are given.
ref: str (optional)
Reference to work with, could be a hash, tag or branch name. Defaults
to current working tree. Note that ``ls`` and ``open`` also take hash,
so this becomes the default for those operations
kwargs
�masterN� )�super�__init__�pygit2�
Repository�os�getcwd�repo�ref)�self�path�for �kwargs� __class__s ��fC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\fsspec/implementations/git.pyr
zGitFileSystem.__init__ sB �� �( ���"�6�"��%�%�b�&?�D�&?�B�I�I�K�@�� ��?�(��� c �� �� t �| � |� j d� }d|v r|j dd� d }d|v r|j dd� d }|j d� S )N�/�:r �@)r �_strip_protocol�lstrip�split)�clsr r s �r r zGitFileSystem._strip_protocol+ sd �� ��w�&�t�,�3�3�C�8���$�;��:�:�c�1�%�a�(�D��$�;��:�:�c�1�%�a�(�D��{�{�3��r c �
� | j j |xs | j � \ }}|j d� }|j }|D ]4 }|s�t |t j � s�!||vrt |� �|| }�6 |S )Nr ) r �resolve_refishr r! �tree�
isinstancer �Tree�FileNotFoundError)r r r �comm�partsr% �parts r �_path_to_objectzGitFileSystem._path_to_object4 su � ��I�I�,�,�S�_�D�H�H�=� ��c��
�
�3����y�y���D��
�4����5��t�#�+�D�1�1��D�z�� �
�r c � � | j d� r| dd } i }d| v r| j dd� \ |d<