summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-23 14:29:34 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-23 14:29:34 +0000
commit61fcb3c568d6c7f5a780d9feff5d9d5a2d83a84d (patch)
tree86bd394454cc22ce79801c11a9904ce673829781 /app
parent17c60173f6e2a543c7a92cd2a992ef8bc1ea2ee6 (diff)
parent9f2e1f504df2fa9ef7d658cbc73bbdba6f897eda (diff)
downloadgitlab-ce-61fcb3c568d6c7f5a780d9feff5d9d5a2d83a84d.tar.gz
Merge branch 'git-follow' into 'master'
Use git follow flag for commits page when retrieve history for file or directory This can be really helpful when you want commit history for file that was moved recently Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> See merge request !1680
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 88d3d73a40e..9d68d8a6dfd 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,
- )
+ follow: path.present?
+ }
+
+ commits = Gitlab::Git::Commit.where(options)
commits = Commit.decorate(commits, @project) if commits.present?
commits
end