Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4925ec50
Commit
4925ec50
authored
Nov 28, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We could simply count the commits
parent
17c53d7d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
app/models/merge_request.rb
app/models/merge_request.rb
+2
-1
changelogs/unreleased/use-count_commits-directly.yml
changelogs/unreleased/use-count_commits-directly.yml
+5
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+1
-1
No files found.
app/models/merge_request.rb
View file @
4925ec50
...
...
@@ -899,7 +899,8 @@ class MergeRequest < ActiveRecord::Base
def
compute_diverged_commits_count
return
0
unless
source_branch_sha
&&
target_branch_sha
Gitlab
::
Git
::
Commit
.
between
(
target_project
.
repository
.
raw_repository
,
source_branch_sha
,
target_branch_sha
).
size
target_project
.
repository
.
count_commits_between
(
source_branch_sha
,
target_branch_sha
)
end
private
:compute_diverged_commits_count
...
...
changelogs/unreleased/use-count_commits-directly.yml
0 → 100644
View file @
4925ec50
---
title
:
Improve the performance for counting commits
merge_request
:
15628
author
:
type
:
performance
lib/gitlab/git/repository.rb
View file @
4925ec50
...
...
@@ -505,7 +505,7 @@ module Gitlab
# Counts the amount of commits between `from` and `to`.
def
count_commits_between
(
from
,
to
)
Commit
.
between
(
self
,
from
,
to
).
size
count_commits
(
ref:
"
#{
from
}
..
#{
to
}
"
)
end
# Returns the SHA of the most recent common ancestor of +from+ and +to+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment