Skip to content

Automerge: stop corrupting commit messages by quoting.

Simon Tatham requested to merge automerge-quoting-fix into arm-software

The commit message for each merge commit should be constructed from that of the original commit by prepending "Automerge: " to the subject line, with no other change. But in fact two extra unwanted transformations were happening: the message was passed through Python shlex.quote, and then enclosed in an extra pair of double quotes.

Neither of these is necessary for shell safety, because no shell is involved. The git commit command is constructed in the form of a list of strings, which directly become the argv of the subprocess, without being parsed by a shell in between. When git sees an argv string beginning with --message=, it will use the remainder of that string unmodified as the commit message. Extra quoting isn't needed, or wanted.

(While I'm here, I've also set the x bit on the script, since it already has a sensible #! line. Now it can be run without manually prefixing an interpreter name.)

Merge request reports