Skip to content

Commit b4e1d56

Browse files
ebishopnejch
authored andcommitted
fix(files): add optional ref parameter for cli project-file raw (python-gitlab#3032)
The ef parameter was removed in python-gitlab v4.8.0. This will add ef back as an optional parameter for the project-file raw cli command.
1 parent e4673d8 commit b4e1d56

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

gitlab/v4/objects/files.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ def delete( # type: ignore[override]
277277
@cli.register_custom_action(
278278
cls_names="ProjectFileManager",
279279
required=("file_path",),
280+
optional=("ref",),
280281
)
281282
@exc.on_http_error(exc.GitlabGetError)
282283
def raw(
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
def test_project_file_raw(gitlab_cli, project, project_file):
2+
cmd = ["project-file", "raw", "--project-id", project.id, "--file-path", "README"]
3+
ret = gitlab_cli(cmd)
4+
assert ret.success
5+
assert "Initial content" in ret.stdout
6+
7+
8+
def test_project_file_raw_ref(gitlab_cli, project, project_file):
9+
cmd = [
10+
"project-file",
11+
"raw",
12+
"--project-id",
13+
project.id,
14+
"--file-path",
15+
"README",
16+
"--ref",
17+
"main",
18+
]
19+
ret = gitlab_cli(cmd)
20+
assert ret.success
21+
assert "Initial content" in ret.stdout

0 commit comments

Comments
 (0)