Project

General

Profile

Patch #42762 » 0002-Change-the-way-commits-are-indexed-for-revision-grap.patch

Go MAEDA, 2025-12-25 11:13

View differences:

app/helpers/repositories_helper.rb
298 298
      }
299 299
    end
300 300
    heads.sort_by!(&:to_s)
301
    space = nil
301
    # Process commits starting from the latest
302
    space = index_head(0, commits.first, commits_by_scmid)
303
    # Process commits from heads
302 304
    heads.each do |head|
303 305
      if commits_by_scmid.include?(head.scmid) && commits_by_scmid[head.scmid][:space].nil?
304
        space = index_head((space || -1) + 1, head, commits_by_scmid)
306
        space = index_head(space + 1, head, commits_by_scmid)
305 307
      end
306 308
    end
307
    # when no head matched anything use first commit
308
    space ||= index_head(0, commits.first, commits_by_scmid)
309
    # Process orphan commits
310
    while (commit = commits.find { |commit| commits_by_scmid[commit.scmid][:space].nil? })
311
      space = index_head(space + 1, commit, commits_by_scmid)
312
    end
309 313
    return commits_by_scmid, space
310 314
  end
311 315

  
(13-13/18)