Update call sites
This commit is contained in:
parent
3d1232eeac
commit
8307255ce8
@ -86,7 +86,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def self.signoff!(path, pull_request: nil, dry_run: false)
|
||||
subject, body, trailers = separate_commit_message(path.git_commit_message)
|
||||
subject, body, trailers = separate_commit_message(path.commit_message)
|
||||
|
||||
if pull_request
|
||||
# This is a tap pull request and approving reviewers should also sign-off.
|
||||
@ -167,7 +167,7 @@ module Homebrew
|
||||
new_package = Utils::Git.file_at_commit(path, file, "HEAD")
|
||||
|
||||
bump_subject = determine_bump_subject(old_package, new_package, package_file, reason: reason).strip
|
||||
subject, body, trailers = separate_commit_message(path.git_commit_message)
|
||||
subject, body, trailers = separate_commit_message(path.commit_message)
|
||||
|
||||
if subject != bump_subject && !subject.start_with?("#{package_name}:")
|
||||
safe_system("git", "-C", path, "commit", "--amend", "-q",
|
||||
@ -192,7 +192,7 @@ module Homebrew
|
||||
messages = []
|
||||
trailers = []
|
||||
commits.each do |commit|
|
||||
subject, body, trailer = separate_commit_message(path.git_commit_message(commit))
|
||||
subject, body, trailer = separate_commit_message(path.commit_message(commit))
|
||||
body = body.lines.map { |line| " #{line.strip}" }.join("\n")
|
||||
messages << "* #{subject}\n#{body}".strip
|
||||
trailers << trailer
|
||||
@ -228,7 +228,7 @@ module Homebrew
|
||||
|
||||
# TODO: fix test in `test/dev-cmd/pr-pull_spec.rb` and assume `cherry_picked: false`.
|
||||
def self.autosquash!(original_commit, tap:, reason: "", verbose: false, resolve: false, cherry_picked: true)
|
||||
original_head = tap.path.git_head
|
||||
original_head = tap.path.head_ref
|
||||
|
||||
commits = Utils.safe_popen_read("git", "-C", tap.path, "rev-list",
|
||||
"--reverse", "#{original_commit}..HEAD").lines.map(&:strip)
|
||||
@ -450,8 +450,8 @@ module Homebrew
|
||||
_, user, repo, pr = *url_match
|
||||
odie "Not a GitHub pull request: #{arg}" unless pr
|
||||
|
||||
if !tap.path.git_default_origin_branch? || args.branch_okay? || args.clean?
|
||||
opoo "Current branch is #{tap.path.git_branch}: do you need to pull inside #{tap.path.git_origin_branch}?"
|
||||
if !tap.path.default_origin_branch? || args.branch_okay? || args.clean?
|
||||
opoo "Current branch is #{tap.path.branch_name}: do you need to pull inside #{tap.path.origin_branch_name}?"
|
||||
end
|
||||
|
||||
pr_labels = GitHub.pull_request_labels(user, repo, pr)
|
||||
@ -464,7 +464,7 @@ module Homebrew
|
||||
ohai "Fetching #{tap} pull request ##{pr}"
|
||||
Dir.mktmpdir pr do |dir|
|
||||
cd dir do
|
||||
current_branch_head = ENV["GITHUB_SHA"] || tap.git_head
|
||||
current_branch_head = ENV["GITHUB_SHA"] || tap.head_ref
|
||||
original_commit = if args.no_cherry_pick?
|
||||
# TODO: Handle the case where `merge-base` returns multiple commits.
|
||||
Utils.safe_popen_read("git", "-C", tap.path, "merge-base", "origin/HEAD", current_branch_head).strip
|
||||
|
||||
@ -128,9 +128,9 @@ module Homebrew
|
||||
|
||||
sig { params(repository_path: GitRepoPath, desired_origin: String).returns(T.nilable(String)) }
|
||||
def examine_git_origin(repository_path, desired_origin)
|
||||
return if !Utils::Git.available? || !repository_path.git?
|
||||
return if !Utils::Git.available? || !repository_path.git_repo?
|
||||
|
||||
current_origin = repository_path.git_origin
|
||||
current_origin = repository_path.origin_url
|
||||
|
||||
if current_origin.nil?
|
||||
<<~EOS
|
||||
|
||||
@ -39,17 +39,17 @@ module SystemConfig
|
||||
|
||||
sig { returns(String) }
|
||||
def head
|
||||
homebrew_repo.git_head || "(none)"
|
||||
homebrew_repo.head_ref || "(none)"
|
||||
end
|
||||
|
||||
sig { returns(String) }
|
||||
def last_commit
|
||||
homebrew_repo.git_last_commit || "never"
|
||||
homebrew_repo.last_committed || "never"
|
||||
end
|
||||
|
||||
sig { returns(String) }
|
||||
def origin
|
||||
homebrew_repo.git_origin || "(none)"
|
||||
homebrew_repo.origin_url || "(none)"
|
||||
end
|
||||
|
||||
sig { returns(String) }
|
||||
|
||||
@ -138,7 +138,7 @@ class Tap
|
||||
def remote
|
||||
return default_remote unless installed?
|
||||
|
||||
@remote ||= path.git_origin
|
||||
@remote ||= path.origin_url
|
||||
end
|
||||
|
||||
# The remote repository name of this {Tap}.
|
||||
@ -166,28 +166,28 @@ class Tap
|
||||
|
||||
# True if this {Tap} is a Git repository.
|
||||
def git?
|
||||
path.git?
|
||||
path.git_repo?
|
||||
end
|
||||
|
||||
# git branch for this {Tap}.
|
||||
def git_branch
|
||||
raise TapUnavailableError, name unless installed?
|
||||
|
||||
path.git_branch
|
||||
path.branch_name
|
||||
end
|
||||
|
||||
# git HEAD for this {Tap}.
|
||||
def git_head
|
||||
raise TapUnavailableError, name unless installed?
|
||||
|
||||
@git_head ||= path.git_head
|
||||
@git_head ||= path.head_ref
|
||||
end
|
||||
|
||||
# Time since last git commit for this {Tap}.
|
||||
def git_last_commit
|
||||
raise TapUnavailableError, name unless installed?
|
||||
|
||||
path.git_last_commit
|
||||
path.last_committed
|
||||
end
|
||||
|
||||
# The issues URL of this {Tap}.
|
||||
@ -388,20 +388,20 @@ class Tap
|
||||
$stderr.ohai "#{name}: changed remote from #{remote} to #{requested_remote}" unless quiet
|
||||
end
|
||||
|
||||
current_upstream_head = T.must(path.git_origin_branch)
|
||||
return if requested_remote.blank? && path.git_origin_has_branch?(current_upstream_head)
|
||||
current_upstream_head = T.must(path.origin_branch_name)
|
||||
return if requested_remote.blank? && path.origin_has_branch?(current_upstream_head)
|
||||
|
||||
args = %w[fetch]
|
||||
args << "--quiet" if quiet
|
||||
args << "origin"
|
||||
safe_system "git", "-C", path, *args
|
||||
path.git_origin_set_head_auto
|
||||
path.set_head_origin_auto
|
||||
|
||||
new_upstream_head = T.must(path.git_origin_branch)
|
||||
new_upstream_head = T.must(path.origin_branch_name)
|
||||
return if new_upstream_head == current_upstream_head
|
||||
|
||||
path.git_rename_branch old: current_upstream_head, new: new_upstream_head
|
||||
path.git_branch_set_upstream local: new_upstream_head, origin: new_upstream_head
|
||||
path.rename_branch old: current_upstream_head, new: new_upstream_head
|
||||
path.set_upstream_branch local: new_upstream_head, origin: new_upstream_head
|
||||
|
||||
return if quiet
|
||||
|
||||
|
||||
@ -98,8 +98,8 @@ describe "brew pr-pull" do
|
||||
File.write(formula_file, formula_version)
|
||||
safe_system Utils::Git.git, "commit", formula_file, "-m", "version", "--author=#{secondary_author}"
|
||||
described_class.autosquash!(original_hash, tap: tap)
|
||||
expect(tap.path.git_commit_message).to include("foo 2.0")
|
||||
expect(tap.path.git_commit_message).to include("Co-authored-by: #{secondary_author}")
|
||||
expect(tap.path.commit_message).to include("foo 2.0")
|
||||
expect(tap.path.commit_message).to include("Co-authored-by: #{secondary_author}")
|
||||
end
|
||||
|
||||
(path/"Casks").mkpath
|
||||
@ -113,8 +113,8 @@ describe "brew pr-pull" do
|
||||
File.write(cask_file, cask_version)
|
||||
safe_system Utils::Git.git, "commit", cask_file, "-m", "version", "--author=#{secondary_author}"
|
||||
described_class.autosquash!(original_hash, tap: tap)
|
||||
expect(path.git_commit_message).to include("food 2.0")
|
||||
expect(path.git_commit_message).to include("Co-authored-by: #{secondary_author}")
|
||||
expect(path.commit_message).to include("food 2.0")
|
||||
expect(path.commit_message).to include("Co-authored-by: #{secondary_author}")
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -129,7 +129,7 @@ describe "brew pr-pull" do
|
||||
safe_system Utils::Git.git, "commit", "-m", "foo 1.0 (new formula)"
|
||||
end
|
||||
described_class.signoff!(tap.path)
|
||||
expect(tap.path.git_commit_message).to include("Signed-off-by:")
|
||||
expect(tap.path.commit_message).to include("Signed-off-by:")
|
||||
|
||||
(path/"Casks").mkpath
|
||||
cask_file.write(cask)
|
||||
@ -138,7 +138,7 @@ describe "brew pr-pull" do
|
||||
safe_system Utils::Git.git, "commit", "-m", "food 1.0 (new cask)"
|
||||
end
|
||||
described_class.signoff!(tap.path)
|
||||
expect(tap.path.git_commit_message).to include("Signed-off-by:")
|
||||
expect(tap.path.commit_message).to include("Signed-off-by:")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ module Utils
|
||||
return git_short_head(repo, length: length) if length.present?
|
||||
|
||||
repo = GitRepoPath.new(Pathname(repo))
|
||||
repo.git_head(safe: safe)
|
||||
repo.head_ref(safe: safe)
|
||||
end
|
||||
|
||||
# Gets a short commit hash of the HEAD commit.
|
||||
@ -29,7 +29,7 @@ module Utils
|
||||
}
|
||||
def self.git_short_head(repo = Pathname.pwd, length: nil, safe: true)
|
||||
repo = GitRepoPath.new(Pathname(repo))
|
||||
repo.git_short_head(length: length, safe: safe)
|
||||
repo.short_head_ref(length: length, safe: safe)
|
||||
end
|
||||
|
||||
# Gets the name of the currently checked-out branch, or HEAD if the repository is in a detached HEAD state.
|
||||
@ -41,7 +41,7 @@ module Utils
|
||||
}
|
||||
def self.git_branch(repo = Pathname.pwd, safe: true)
|
||||
repo = GitRepoPath.new(Pathname(repo))
|
||||
repo.git_branch(safe: safe)
|
||||
repo.branch_name(safe: safe)
|
||||
end
|
||||
|
||||
# Gets the full commit message of the specified commit, or of the HEAD commit if unspecified.
|
||||
@ -54,6 +54,6 @@ module Utils
|
||||
}
|
||||
def self.git_commit_message(repo = Pathname.pwd, commit: "HEAD", safe: true)
|
||||
repo = GitRepoPath.new(Pathname(repo))
|
||||
repo.git_commit_message(commit, safe: safe)
|
||||
repo.commit_message(commit, safe: safe)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user