Commit 61fcb3c5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

See merge request !1680
parents 17c60173 9f2e1f50
...@@ -10,6 +10,7 @@ v 8.2.0 (unreleased) ...@@ -10,6 +10,7 @@ v 8.2.0 (unreleased)
- Allow users to select the Files view as default project view (Cristian Bica) - Allow users to select the Files view as default project view (Cristian Bica)
- Show "Empty Repository Page" for repository without branches (Artem V. Navrotskiy) - 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 - 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 v 8.1.0
- Ensure MySQL CI limits DB migrations occur after the fields have been created (Stan Hu) - Ensure MySQL CI limits DB migrations occur after the fields have been created (Stan Hu)
......
...@@ -67,13 +67,16 @@ class Repository ...@@ -67,13 +67,16 @@ class Repository
end end
def commits(ref, path = nil, limit = nil, offset = nil, skip_merges = false) def commits(ref, path = nil, limit = nil, offset = nil, skip_merges = false)
commits = Gitlab::Git::Commit.where( options = {
repo: raw_repository, repo: raw_repository,
ref: ref, ref: ref,
path: path, path: path,
limit: limit, limit: limit,
offset: offset, offset: offset,
) follow: path.present?
}
commits = Gitlab::Git::Commit.where(options)
commits = Commit.decorate(commits, @project) if commits.present? commits = Commit.decorate(commits, @project) if commits.present?
commits commits
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment