From e151fcb7b962739ff47532c94265f4faa3bdc8d0 Mon Sep 17 00:00:00 2001 From: laube Date: Wed, 9 Jul 2014 22:27:12 +0200 Subject: [PATCH 1/2] Use git log --follow to get commits collection --- lib/gitlab_git/commit.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/gitlab_git/commit.rb b/lib/gitlab_git/commit.rb index 4070448..ee0efed 100644 --- a/lib/gitlab_git/commit.rb +++ b/lib/gitlab_git/commit.rb @@ -26,6 +26,11 @@ class << self # ) # def where(options) + default_options = { + follow: options[:path].present? + } + options = default_options.merge(options) + repo = options.delete(:repo) raise 'Gitlab::Git::Repository is required' unless repo.respond_to?(:log) From f79fe704ccd2fbe0675a55b2bd522ec244729842 Mon Sep 17 00:00:00 2001 From: laube Date: Thu, 17 Jul 2014 15:20:01 +0200 Subject: [PATCH 2/2] avoid error when options does not include path at all --- lib/gitlab_git/commit.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/gitlab_git/commit.rb b/lib/gitlab_git/commit.rb index ee0efed..9ce40fc 100644 --- a/lib/gitlab_git/commit.rb +++ b/lib/gitlab_git/commit.rb @@ -26,10 +26,9 @@ class << self # ) # def where(options) - default_options = { - follow: options[:path].present? - } - options = default_options.merge(options) + if options.has_key?(:path) and options[:path].present? + options[:follow] = true + end repo = options.delete(:repo) raise 'Gitlab::Git::Repository is required' unless repo.respond_to?(:log)