From 080bd8bd4a0723c585984509aa3ed257b094c4f2 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sun, 18 Jul 2021 05:27:07 +0800 Subject: [PATCH] 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. --- Library/Homebrew/dev-cmd/pr-publish.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/pr-publish.rb b/Library/Homebrew/dev-cmd/pr-publish.rb index c13ad95a6d..5126e8315c 100644 --- a/Library/Homebrew/dev-cmd/pr-publish.rb +++ b/Library/Homebrew/dev-cmd/pr-publish.rb @@ -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 " "