redmine-backporter: Clarify the actual control flow

The `rev && has_commit(rev, "ruby_#{TARGET_VERSION.tr('.','_')}")`
case seems to be used if and only if it's manually specified in the
argument to the done command. It was hard to notice it with the previous
code.
This commit is contained in:
Takashi Kokubun 2024-09-02 02:05:21 -07:00
parent 73c39a5f93
commit 7d47f3c94f

View File

@ -351,10 +351,9 @@ eom
next
end
if rev.nil? && log = find_git_log("##@issue]")
/^commit (?<rev>\h{40})$/ =~ log
end
if log && rev
if rev && has_commit(rev, "ruby_#{TARGET_VERSION.tr('.','_')}")
notes = "ruby_#{TARGET_VERSION.tr('.','_')} commit:#{rev}."
elsif rev.nil? && (log = find_git_log("##@issue]")) && /^commit (?<rev>\h{40})$/ =~ log
str = log[/merge revision\(s\) ([^:]+)(?=:)/]
if str
str.sub!(/\Amerge/, 'merged')
@ -368,10 +367,6 @@ eom
str << notes
end
notes = str
elsif rev && has_commit(rev, "ruby_#{TARGET_VERSION.tr('.','_')}")
# Backport commit's log doesn't have the issue number.
# Instead of that manually it's provided.
notes = "ruby_#{TARGET_VERSION.tr('.','_')} commit:#{rev}."
else
puts "no commit is found whose log include ##@issue"
next