Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-23 14:13:22 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-23 14:13:22 +0300
commit03ea0c74af8bfe6600eb4a7cc04a5d6cfc677f59 (patch)
tree911433888b2953cb5d3e1c48803eee25425bc30e
parent7f5acdb20ac9b5908e6cf15c8fb5f7952a745f1c (diff)
Use git follow flag for commits page when retrieve history for file or directory
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/repository.rb7
2 files changed, 6 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c70cc33cce2..19a5876c4f1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@ v 8.2.0 (unreleased)
- Allow users to select the Files view as default project view (Cristian Bica)
- Show "Empty Repository Page" for repository without branches (Artem V. Navrotskiy)
- Fix: Inability to reply to code comments in the MR view, if the MR comes from a fork
+ - Use git follow flag for commits page when retrieve history for file or directory
v 8.1.0
- Ensure MySQL CI limits DB migrations occur after the fields have been created (Stan Hu)
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 88d3d73a40e..a517c7d6982 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -67,13 +67,16 @@ class Repository
end
def commits(ref, path = nil, limit = nil, offset = nil, skip_merges = false)
- commits = Gitlab::Git::Commit.where(
+ options = {
repo: raw_repository,
ref: ref,
path: path,
limit: limit,
offset: offset,
- )
+ }
+
+ options[:follow] = true if path.present?
+ commits = Gitlab::Git::Commit.where(options)
commits = Commit.decorate(commits, @project) if commits.present?
commits
end