diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2015-03-03 11:50:21 -0800 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2015-03-03 11:50:21 -0800 |
commit | e6a0fb1f77214eb143339f52670cc84fbbf1f645 (patch) | |
tree | 2470b4d0f5e9c261d0a7fada2dc80e7c20cb4b89 | |
parent | 4697daf71a6c0bbbd42bc932b4b63698024cc59a (diff) | |
parent | c1fc29e1f8c1a309f2125655b64d125bf61ea79d (diff) | |
download | gitlab-ce-e6a0fb1f77214eb143339f52670cc84fbbf1f645.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/repository.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/url_builder.rb | 9 | ||||
-rw-r--r-- | spec/lib/gitlab/url_builder_spec.rb | 8 |
4 files changed, 19 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 6a28772097e..6aa30c1b9b2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.9.0 (unreleased) + - Fix merge request URL passed to Webhooks. (Stan Hu) - Move labels/milestones tabs to sidebar - Upgrade Rails gem to version 4.1.9. - Improve error messages for file edit failures diff --git a/app/models/repository.rb b/app/models/repository.rb index bbf35f04bbc..5b52739df2b 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -146,7 +146,7 @@ class Repository end def timestamps_by_user_log(user) - args = %W(git log --author=#{user.email} --since=#{(Date.today - 1.year).to_s} --pretty=format:%cd --date=short) + args = %W(git log --author=#{user.email} --since=#{(Date.today - 1.year).to_s} --branches --pretty=format:%cd --date=short) dates = Gitlab::Popen.popen(args, path_to_repo).first.split("\n") if dates.present? diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb index e7153cc3225..7ab3f090a89 100644 --- a/lib/gitlab/url_builder.rb +++ b/lib/gitlab/url_builder.rb @@ -10,6 +10,8 @@ module Gitlab case @type when :issue issue_url(id) + when :merge_request + merge_request_url(id) end end @@ -22,5 +24,12 @@ module Gitlab project_id: issue.project, host: Gitlab.config.gitlab['url']) end + + def merge_request_url(id) + merge_request = MergeRequest.find(id) + project_merge_request_url(id: merge_request.id, + project_id: merge_request.project, + host: Gitlab.config.gitlab['url']) + end end end diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb index 716430340b6..518239fab6d 100644 --- a/spec/lib/gitlab/url_builder_spec.rb +++ b/spec/lib/gitlab/url_builder_spec.rb @@ -8,4 +8,12 @@ describe Gitlab::UrlBuilder do expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.path_with_namespace}/issues/#{issue.iid}" end end + + describe 'When asking for an merge request' do + it 'returns the merge request url' do + merge_request = create(:merge_request) + url = Gitlab::UrlBuilder.new(:merge_request).build(merge_request.id) + expect(url).to eq "#{Settings.gitlab['url']}/#{merge_request.project.to_param}/merge_requests/#{merge_request.id}" + end + end end |