diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-25 17:10:10 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-25 17:10:10 +0400 |
commit | 66ef5c1aa2f50b93ad654dc3b8d9f3a0f5c8bc1b (patch) | |
tree | 6abfee6bfa7f9a34ffa03d03d546cb27a74c6855 /lib | |
parent | 3bf316dbd9b4c555ef9b21f43d56c7d7309766d7 (diff) |
Fix satellites
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/satellite/merge_action.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 7c9b2294647..e9141f735aa 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -65,15 +65,16 @@ module Gitlab prepare_satellite!(merge_repo) update_satellite_source_and_target!(merge_repo) if merge_request.for_fork? - # Only show what is new in the source branch compared to the target branch, not the other way around. - # The line below with merge_base is equivalent to diff with three dots (git diff branch1...branch2) - # From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B" - common_commit = merge_repo.git.native(:merge_base, default_options, ["origin/#{merge_request.target_branch}", "source/#{merge_request.source_branch}"]).strip - diffs = merge_repo.diff(common_commit, "source/#{merge_request.source_branch}") + repository = Gitlab::Git::Repository.new(merge_repo.path) + diffs = Gitlab::Git::Diff.between( + repository, + "source/#{merge_request.source_branch}", + "origin/#{merge_request.target_branch}" + ) else raise "Attempt to determine diffs between for a non forked merge request in satellite MergeRequest.id:[#{merge_request.id}]" end - diffs = diffs.map { |diff| Gitlab::Git::Diff.new(diff) } + return diffs end rescue Grit::Git::CommandFailed => ex @@ -97,11 +98,16 @@ module Gitlab prepare_satellite!(merge_repo) update_satellite_source_and_target!(merge_repo) if (merge_request.for_fork?) - commits = merge_repo.commits_between("origin/#{merge_request.target_branch}", "source/#{merge_request.source_branch}") + repository = Gitlab::Git::Repository.new(merge_repo.path) + commits = Gitlab::Git::Commit.between( + repository, + "origin/#{merge_request.target_branch}", + "source/#{merge_request.source_branch}" + ) else raise "Attempt to determine commits between for a non forked merge request in satellite MergeRequest.id:[#{merge_request.id}]" end - commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) } + return commits end rescue Grit::Git::CommandFailed => ex |