From 03ea0c74af8bfe6600eb4a7cc04a5d6cfc677f59 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 23 Oct 2015 13:13:22 +0200 Subject: Use git follow flag for commits page when retrieve history for file or directory Signed-off-by: Dmitriy Zaporozhets --- app/models/repository.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app') 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 -- cgit v1.2.1 From 9f2e1f504df2fa9ef7d658cbc73bbdba6f897eda Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 23 Oct 2015 14:39:27 +0200 Subject: Refactor git follow option set Signed-off-by: Dmitriy Zaporozhets --- app/models/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/repository.rb b/app/models/repository.rb index a517c7d6982..9d68d8a6dfd 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -73,9 +73,9 @@ class Repository path: path, limit: limit, offset: offset, + follow: path.present? } - options[:follow] = true if path.present? commits = Gitlab::Git::Commit.where(options) commits = Commit.decorate(commits, @project) if commits.present? commits -- cgit v1.2.1