Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(files): add support for optional ref parameter for cli project-file raw #3077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gitlab/v4/objects/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def delete( # type: ignore[override]
@cli.register_custom_action(
cls_names="ProjectFileManager",
required=("file_path",),
optional=("ref",),
)
@exc.on_http_error(exc.GitlabGetError)
def raw(
Expand Down
21 changes: 21 additions & 0 deletions tests/functional/cli/test_cli_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def test_project_file_raw(gitlab_cli, project, project_file):
cmd = ["project-file", "raw", "--project-id", project.id, "--file-path", "README"]
ret = gitlab_cli(cmd)
assert ret.success
assert "Initial content" in ret.stdout


def test_project_file_raw_ref(gitlab_cli, project, project_file):
cmd = [
"project-file",
"raw",
"--project-id",
project.id,
"--file-path",
"README",
"--ref",
"main",
]
ret = gitlab_cli(cmd)
assert ret.success
assert "Initial content" in ret.stdout
Loading