Skip to content
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
4 changes: 3 additions & 1 deletion lando_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ def display_add_commit_actions(
click.echo(f"About to push {len(actions)} commits.")

# Use the last patch as the tip commit
last_patch = base64.b64decode(actions[-1]["content"]).decode("utf-8")
last_patch = base64.b64decode(actions[-1]["content"]).decode(
"utf-8", errors="surrogateescape"
)
first_line = last_patch.splitlines()[0]

if first_line.startswith("From "):
Expand Down
10 changes: 9 additions & 1 deletion tests/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,25 @@ def mock_submit_to_lando(monkeypatch: pytest.MonkeyPatch) -> mock.Mock:
return mock_fixture


@pytest.mark.parametrize(
"commit_data",
(
"just a string",
b"-\x1f\x8b\n", # GZip magic bytes
),
)
def test_push_commits(
git_local_repo: Path,
create_commit: Callable,
mock_get_repo_info: mock.Mock,
mock_submit_to_lando: mock.Mock,
commit_data: bytes | str,
):
commit_message = "New commit to push"

runner = CliRunner()
with runner.isolated_filesystem(git_local_repo):
create_commit(commit_message=commit_message)
create_commit(commit_data, commit_message=commit_message)
result = runner.invoke(cli.push_commits, ["--yes"])

assert result.exit_code == 0
Expand Down
Loading