зеркало из https://github.com/github/ruby.git
sync_default_gems.rb: Fix substitution [ci skip]
As there should be no modified files just affter `git cherry-pick` succeeded in `sync_default_gems_with_commits`, reset to the previous revision once to pick up the committed files.
This commit is contained in:
Родитель
779917fcc0
Коммит
230c7de252
|
@ -86,7 +86,8 @@ end
|
|||
|
||||
def replace_rdoc_ref(file)
|
||||
src = File.binread(file)
|
||||
src.gsub!(%r[\[\Khttps://docs\.ruby-lang\.org/en/master(?:/doc)?/(([A-Z]\w+(?:/[A-Z]\w+)*)|\w+_rdoc)\.html(\#\S+)?(?=\])]) do
|
||||
changed = false
|
||||
changed |= src.gsub!(%r[\[\Khttps://docs\.ruby-lang\.org/en/master(?:/doc)?/(([A-Z]\w+(?:/[A-Z]\w+)*)|\w+_rdoc)\.html(\#\S+)?(?=\])]) do
|
||||
name, mod, label = $1, $2, $3
|
||||
mod &&= mod.gsub('/', '::')
|
||||
if label && (m = label.match(/\A\#(?:method-([ci])|(?:(?:class|module)-#{mod}-)?label)-([-+\w]+)\z/))
|
||||
|
@ -94,7 +95,8 @@ def replace_rdoc_ref(file)
|
|||
scope = scope ? scope.tr('ci', '.#') : '@'
|
||||
end
|
||||
"rdoc-ref:#{mod || name.chomp("_rdoc") + ".rdoc"}#{scope}#{label}"
|
||||
end or return false
|
||||
end
|
||||
changed or return false
|
||||
File.rename(file, file + "~")
|
||||
File.binwrite(file, src)
|
||||
return true
|
||||
|
@ -554,7 +556,11 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil)
|
|||
next
|
||||
end
|
||||
|
||||
if replace_rdoc_ref_all
|
||||
head = `git log --format=%H -1 HEAD`.chomp
|
||||
system(*%w"git reset --quiet HEAD~ --")
|
||||
amend = replace_rdoc_ref_all
|
||||
system(*%w"git reset --quiet #{head} --")
|
||||
if amend
|
||||
`git commit --amend --no-edit --all`
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче