Project

General

Profile

Patch #37614 » 0005-Use-the-safe-navigation-operator-instead-of-checking.patch

Go MAEDA, 2022-08-28 07:15

View differences:

app/models/repository/git.rb
40 40
  end
41 41

  
42 42
  def report_last_commit
43
    return false if extra_info.nil?
44

  
45
    v = extra_info["extra_report_last_commit"]
43
    v = extra_info&.fetch('extra_report_last_commit', nil)
46 44
    return false if v.nil?
47 45

  
48 46
    v.to_s != '0'
......
133 131
    scm_brs = branches
134 132
    return if scm_brs.blank?
135 133

  
136
    h1 = extra_info || {}
137
    h  = h1.dup
134
    h = extra_info&.dup || {}
138 135
    repo_heads = scm_brs.map(&:scmid)
139
    h["heads"] ||= []
140
    prev_db_heads = h["heads"].dup
136
    prev_db_heads = h["heads"]&.dup || []
141 137
    prev_db_heads += heads_from_branches_hash if prev_db_heads.empty?
142 138
    return if prev_db_heads.sort == repo_heads.sort
143 139

  
......
232 228
  private :save_revision
233 229

  
234 230
  def heads_from_branches_hash
235
    h1 = extra_info || {}
236
    h  = h1.dup
231
    h = extra_info&.dup || {}
237 232
    h["branches"] ||= {}
238 233
    h['branches'].map{|br, hs| hs['last_scmid']}
239 234
  end
(5-5/6)