Skip to content

Commit

Permalink
envoy.base.utils(0.5.9): Fix project commit escape (take2) (#2537)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <[email protected]>
  • Loading branch information
phlax authored Jan 13, 2025
1 parent 47e9244 commit 5c70573
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion envoy.base.utils/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.8
0.5.9
4 changes: 2 additions & 2 deletions envoy.base.utils/envoy/base/utils/abstract/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ async def _git_commit(
else [])
await self._exec(
" ".join(("git", "add", *changed)))
msg = msg.replace("'", r"\'")
msg = msg.replace("`", r"\`").replace('"', r"\"")
await self._exec(
" ".join((
"git", "commit", *author_args, *changed,
"-m", f"'{msg}'")))
"-m", f"\"{msg}\"")))

def _patch_versions(
self,
Expand Down
12 changes: 9 additions & 3 deletions envoy.base.utils/tests/test_abstract_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,12 +1073,18 @@ async def test_abstract_project__git_commit(iters, patches):
== [[(" ".join(["git", "add", *changed]), ),
{}],
[(" ".join([
"git", "commit", *changed,
"-m", f"'{msg.replace.return_value}'"]), ),
"git",
"commit",
*changed,
"-m",
f"\"{msg.replace.return_value.replace.return_value}\""]), ),
{}]])
assert (
msg.replace.call_args
== [("'", r"\'"), {}])
== [("`", r"\`"), {}])
assert (
msg.replace.return_value.replace.call_args
== [('"', r"\""), {}])


@pytest.mark.parametrize("returns", [None, 0, 23, "cabbage"])
Expand Down

0 comments on commit 5c70573

Please sign in to comment.