diff options
author | Go MAEDA <maeda@farend.jp> | 2022-09-25 05:07:09 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2022-09-25 05:07:09 +0000 |
commit | a1126aebd40125d3f523c9e2d4ec46951e264a3e (patch) | |
tree | a1bd2b31410b5207a986dce2e618e9e16900b6a5 /app | |
parent | fa3a42d1de92fcd66082b92ea70b97303ee971ab (diff) | |
download | redmine-a1126aebd40125d3f523c9e2d4ec46951e264a3e.tar.gz redmine-a1126aebd40125d3f523c9e2d4ec46951e264a3e.zip |
Use the safe navigation operator instead of checking if an object is nil (#37614).
Patch by Go MAEDA.
git-svn-id: https://svn.redmine.org/redmine/trunk@21844 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository/git.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index b5927ad79..54bceba72 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -133,11 +133,9 @@ class Repository::Git < Repository scm_brs = branches return if scm_brs.blank? - h1 = extra_info || {} - h = h1.dup + h = extra_info&.dup || {} repo_heads = scm_brs.map(&:scmid) - h["heads"] ||= [] - 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 @@ -232,8 +230,7 @@ class Repository::Git < Repository private :save_revision def heads_from_branches_hash - h1 = extra_info || {} - h = h1.dup + h = extra_info&.dup || {} h["branches"] ||= {} h['branches'].map{|br, hs| hs['last_scmid']} end |