diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-08-30 08:05:13 +0200 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2017-08-31 15:45:48 +0200 |
commit | ed8f7ed671a5fb6197c9e4759bf13742cf967f50 (patch) | |
tree | 9b557b7dabc264cca65d7e50a18e2f7cc5111c8a /lib | |
parent | 9e7e0496ff639d1eec65dcbf1b51edb2262456e2 (diff) | |
download | gitlab-ce-ed8f7ed671a5fb6197c9e4759bf13742cf967f50.tar.gz |
Sort templates when fetching them
Used to rely on the underlying filesystem to sort the entries, now its
forced to be sorted on the name of the template.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/template/base_template.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/template/base_template.rb b/lib/gitlab/template/base_template.rb index 7ebec8e2cff..7393574ac13 100644 --- a/lib/gitlab/template/base_template.rb +++ b/lib/gitlab/template/base_template.rb @@ -18,6 +18,10 @@ module Gitlab { name: name, content: content } end + def <=>(other) + name <=> other.name + end + class << self def all(project = nil) if categories.any? @@ -58,7 +62,7 @@ module Gitlab directory = category_directory(category) files = finder(project).list_files_for(directory) - files.map { |f| new(f, project) } + files.map { |f| new(f, project) }.sort end def category_directory(category) |