summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-05-11 16:23:02 +0100
committerSean McGivern <sean@gitlab.com>2017-05-12 20:47:51 +0100
commitad2bfeb85756db8c4cea9290be743665efd1c918 (patch)
treecf51b926c348db7a7f5df26117a692f55416fe25 /app/presenters
parentaec53bab05afd0a20b15bd9311643f8bf5efd140 (diff)
downloadgitlab-ce-ad2bfeb85756db8c4cea9290be743665efd1c918.tar.gz
Fix conflict resolution from corrupted upstreamfix-conflict-resolution-with-corrupt-repos
I don't know why this happens exactly, but given an upstream and fork repository from a customer, both of which required GC, resolving conflicts would corrupt the fork so badly that it couldn't be cloned. This isn't a perfect fix for that case, because the MR may still need to be merged manually, but it does ensure that the repository is at least usable. My best guess is that when we generate the index for the conflict resolution (which we previously did in the target project), we obtain a reference to an OID that doesn't exist in the source, even though we already fetch the refs from the target into the source. Explicitly setting the source project as the place to get the merge index from seems to prevent repository corruption in this way.
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/merge_request_presenter.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb
index 255f63db5c2..0db9e31031c 100644
--- a/app/presenters/merge_request_presenter.rb
+++ b/app/presenters/merge_request_presenter.rb
@@ -76,7 +76,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
end
def conflict_resolution_path
- if conflicts_can_be_resolved_in_ui? && conflicts_can_be_resolved_by?(current_user)
+ if conflicts.can_be_resolved_in_ui? && conflicts.can_be_resolved_by?(current_user)
conflicts_namespace_project_merge_request_path(project.namespace, project, merge_request)
end
end
@@ -141,6 +141,10 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
private
+ def conflicts
+ @conflicts ||= MergeRequests::Conflicts::ListService.new(merge_request)
+ end
+
def closing_issues
@closing_issues ||= closes_issues(current_user)
end