dev-cmd/pr-publish: pass --autosquash by default

It's too easy to forget to, and the consequences of forgetting to pass
`--autosquash` are worse (i.e. almost always permanent) than forgetting
to pass `--no-autosquash` (i.e. just do `pr-publish --no-autosquash`
when your command fails).

See the discussion at Homebrew/homebrew-core#80717.
This commit is contained in:
Carlo Cabrera 2021-07-18 05:27:07 +08:00
parent 12d272abe8
commit 080bd8bd4a
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -19,6 +19,9 @@ module Homebrew
switch "--autosquash",
description: "If supported on the target tap, automatically reformat and reword commits "\
"in the pull request to our preferred format."
switch "--no-autosquash",
description: "Skip automatically reformatting and rewording commits in the pull request "\
"to the preferred format, even if supported on the target tap."
flag "--branch=",
description: "Branch to publish to (default: `master`)."
flag "--message=",
@ -40,8 +43,10 @@ module Homebrew
workflow = args.workflow || "publish-commit-bottles.yml"
ref = args.branch || "master"
odeprecated "`brew pr-publish --autosquash`" if args.autosquash?
extra_args = []
extra_args << "--autosquash" if args.autosquash?
extra_args << "--autosquash" unless args.no_autosquash?
extra_args << "--message='#{args.message}'" if args.message.presence
dispatch_args = extra_args.join " "