diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-07-02 11:53:43 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-07-02 11:53:43 +0300 |
commit | 6a1b17c4d5015ab81c2aa7fa7dc2d0536e8c4669 (patch) | |
tree | 593795f25d6f682072eb280ef6372a5842385a43 /app/models/repository.rb | |
parent | 17a38b5a8b722db6f7ebf1c6eb801c63ad371880 (diff) | |
parent | 047ca033e564c815b6503e46f07f1a0f65903317 (diff) |
Merge branch 'fix/gb/make-root-ref-default-instead-of-head' into 'master'
Use root ref instead of HEAD to find latest repository commit
Closes gitlab-ee#5864
See merge request gitlab-org/gitlab-ce!20258
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 2a50855d4b1..5f9894f1168 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -99,11 +99,11 @@ class Repository "#<#{self.class.name}:#{@disk_path}>" end - def commit(ref = 'HEAD') + def commit(ref = nil) return nil unless exists? return ref if ref.is_a?(::Commit) - find_commit(ref) + find_commit(ref || root_ref) end # Finding a commit by the passed SHA |