Merge pull request #11977 from Moisan/bump_revision_write

bump-revision: add --write switch
This commit is contained in:
Mike McQuaid 2021-09-14 10:16:41 +01:00 committed by GitHub
commit bf7b043392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -290,6 +290,9 @@ module Homebrew
sig { returns(T.nilable(T::Array[String])) }
def groups; end
sig { returns(T::Boolean) }
def write_only?; end
end
end
end

View File

@ -18,9 +18,13 @@ module Homebrew
EOS
switch "-n", "--dry-run",
description: "Print what would be done rather than doing it."
switch "--write-only",
description: "Make the expected file modifications without taking any Git actions."
flag "--message=",
description: "Append <message> to the default commit message."
conflicts "--dry-run", "--write-only"
named_args :formula, min: 1
end
end
@ -62,7 +66,7 @@ module Homebrew
message = "#{formula.name}: revision bump #{args.message}"
if args.dry_run?
ohai "git commit --no-edit --verbose --message=#{message} -- #{formula.path}"
else
elsif !args.write_only?
formula.path.parent.cd do
safe_system "git", "commit", "--no-edit", "--verbose",
"--message=#{message}", "--", formula.path