File: //opt/saltstack/salt/lib/python3.10/site-packages/gitdb/__pycache__/fun.cpython-310.pyc
o
;j�Z � @ s� d Z ddlZddlmZ ejZddlZddlmZ ddlm Z ddl
mZmZ ddl
mZ ddlmZmZmZmZ dd lmZ d
ZdZeefZddd
ededededdedediZed
edededdedeiZdej ZdZdd� Zdd� Zdd� Z dd� Z!G dd� d�Z"d d!� Z#d"d#� Z$d$d%� Z%G d&d'� d'e&�Z'G d(d)� d)e'�Z(d*d+� Z)d,d-� Z*d.d/� Z+d0d1� Z,dAd2d3�Z-d4d5� Z.efd6d7�Z/d8d9� Z0d:d;� Z1d<d=� Z2d>d?� Z3z dd@l4m1Z1 W dS e5y� Y dS w )Bz�Contains basic c-functions which usually contain performance critical code
Keeping this code separate from the beginning makes it easier to out-source
it into c later, if required� N��byte_ord)�islice)�reduce)� NULL_BYTE�
BYTE_SPACE)�
force_text)�
str_blob_type�str_commit_type�
str_tree_type�str_tag_type)�StringIO� � � � � � � � � OFS_DELTA� REF_DELTAi� )�is_loose_object�loose_object_header_info�msb_size�pack_object_header_info�write_object�loose_object_header�stream_copy�apply_delta_data�is_equal_canonical_sha�connect_deltas�DeltaChunkList�create_pack_object_headerc C s
|| _ | S )z�Truncate the given delta to the given size
:param size: size relative to our target offset, may not be 0, must be smaller or equal
to our size
:return: d��ts)�d�size� r( �=/opt/saltstack/salt/lib/python3.10/site-packages/gitdb/fun.py�_set_delta_rbound? s r* c C sT |dkrdS | j |7 _ | j|7 _| j|8 _| jdur(| j|d� | _| S )z�Move the delta by the given amount of bytes, reducing its size so that its
right bound stays static
:param bytes: amount of bytes to move, must be smaller than delta size
:return: dr N)�to�sor% �data)r&