diff --git a/gitlab/v4/objects/repositories.py b/gitlab/v4/objects/repositories.py index e968a6a6a..b8dbdd8af 100644 --- a/gitlab/v4/objects/repositories.py +++ b/gitlab/v4/objects/repositories.py @@ -201,6 +201,7 @@ def repository_archive( action: Optional[Callable[..., Any]] = None, chunk_size: int = 1024, format: Optional[str] = None, + path: Optional[str] = None, *, iterator: bool = False, **kwargs: Any, @@ -218,6 +219,7 @@ def repository_archive( data chunk_size: Size of each chunk format: file format (tar.gz by default) + path: The subpath of the repository to download (all files by default) **kwargs: Extra options to send to the server (e.g. sudo) Raises: @@ -227,14 +229,16 @@ def repository_archive( Returns: The binary data of the archive """ - path = f"/projects/{self.encoded_id}/repository/archive" + url_path = f"/projects/{self.encoded_id}/repository/archive" if format: - path += "." + format + url_path += "." + format query_data = {} if sha: query_data["sha"] = sha + if path is not None: + query_data["path"] = path result = self.manager.gitlab.http_get( - path, query_data=query_data, raw=True, streamed=streamed, **kwargs + url_path, query_data=query_data, raw=True, streamed=streamed, **kwargs ) if TYPE_CHECKING: assert isinstance(result, requests.Response) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy