dev-cmd/pr-pull: use git_extensions
This commit is contained in:
parent
75be0ca4d0
commit
5bda84b594
@ -216,7 +216,8 @@ module Homebrew
|
||||
end
|
||||
|
||||
def autosquash!(original_commit, path: ".", reason: "", verbose: false, resolve: false)
|
||||
original_head = Utils.safe_popen_read("git", "-C", path, "rev-parse", "HEAD").strip
|
||||
path = Pathname(path).extend(GitRepositoryExtension)
|
||||
original_head = path.git_head
|
||||
|
||||
commits = Utils.safe_popen_read("git", "-C", path, "rev-list",
|
||||
"--reverse", "#{original_commit}..HEAD").lines.map(&:strip)
|
||||
@ -394,7 +395,7 @@ module Homebrew
|
||||
ohai "Fetching #{tap} pull request ##{pr}"
|
||||
Dir.mktmpdir pr do |dir|
|
||||
cd dir do
|
||||
original_commit = Utils.popen_read("git", "-C", tap.path, "rev-parse", "HEAD").chomp
|
||||
original_commit = tap.path.git_head
|
||||
cherry_pick_pr!(user, repo, pr, path: tap.path, args: args)
|
||||
if args.autosquash? && !args.dry_run?
|
||||
autosquash!(original_commit, path: tap.path,
|
||||
|
||||
@ -58,7 +58,7 @@ describe Homebrew do
|
||||
safe_system Utils::Git.git, "commit", formula_file, "-m", "revision"
|
||||
File.open(formula_file, "w") { |f| f.write(formula_version) }
|
||||
safe_system Utils::Git.git, "commit", formula_file, "-m", "version", "--author=#{secondary_author}"
|
||||
described_class.autosquash!(original_hash, path: ".")
|
||||
described_class.autosquash!(original_hash, path: path)
|
||||
expect(Utils::Git.commit_message(path)).to include("foo 2.0")
|
||||
expect(Utils::Git.commit_message(path)).to include("Co-authored-by: #{secondary_author}")
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user