]> source.dussan.org Git - redmine.git/commitdiff
Fix RuboCop offense Lint/RedundantSafeNavigation (#36919).
authorGo MAEDA <maeda@farend.jp>
Wed, 7 Jun 2023 13:04:35 +0000 (13:04 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 7 Jun 2023 13:04:35 +0000 (13:04 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22253 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository/git.rb

index 2c77c173d8fc5f4e6467e23110833bdd28372d2e..d67540f8b075ed230e879d7a7c3de2c34e2b6747 100644 (file)
@@ -133,9 +133,9 @@ class Repository::Git < Repository
     scm_brs = branches
     return if scm_brs.blank?
 
-    h = extra_info&.dup || {}
+    h = extra_info.dup || {}
     repo_heads = scm_brs.map(&:scmid)
-    prev_db_heads = h["heads"]&.dup || []
+    prev_db_heads = h["heads"].dup || []
     prev_db_heads += heads_from_branches_hash if prev_db_heads.empty?
     return if prev_db_heads.sort == repo_heads.sort
 
@@ -230,7 +230,7 @@ class Repository::Git < Repository
   private :save_revision
 
   def heads_from_branches_hash
-    h = extra_info&.dup || {}
+    h = extra_info.dup || {}
     h["branches"] ||= {}
     h['branches'].map{|br, hs| hs['last_scmid']}
   end