Retrieves a file's metadata via the
HEAD /projects/{id_project}/repository/files/{path} endpoint of GitLab's v4
RESTful API.
Usage
file_meta(
path,
attribute = c("file_name", "file_path", "size", "encoding", "content_sha256", "ref",
"blob_id", "commit_id", "last_commit_id", "execute_filemode"),
id_project = funky::config_val("id_project"),
ref = "HEAD",
base_url = funky::config_val("base_url"),
token = funky::config_val("token"),
max_tries = 3L
)Arguments
- path
character(1)
File path, relative to the repository root.- attribute
character(1)
Name of the metadata attribute to return.- id_project
integer(1)
GitLab project identifier.- ref
character(1)
Git revision expression matching the desired Git tree object, e.g. a ref name (branch, tag, etc.), a commit identifier, or another symbolic reference like"HEAD~10". Omitted ifNULL, otherwise set as a URL parameter in the API request. Note that the GitLab API doesn't support every type of revision expression.- base_url
character(1)
Base URL to the GitLab v4 RESTful API root.- token
character(1)
GitLab access token used for authentication. IfNULL, the API request is made unauthenticated which results in HTTP 404 Not Found and other errors for non-public resources.- max_tries
integer(1)
Maximum number of request attempts in case of an HTTP error. An integerish scalar. Retries are performed using exponential backoff and jitter, seehttr2::req_retry()for details.
Value
An integer scalar if attribute = "size", a logical scalar if attribute = "execute_filemode", or a character scalar in all other cases.
Note that an empty vector is returned for invalid refs.
See also
Other functions to manage files on GitLab:
commit_files(),
file_commit_action(),
file_content(),
file_create(),
file_delete(),
file_exists(),
file_full(),
file_req(),
file_update(),
file_write(),
files_delete()