diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-07 13:54:58 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-07 13:54:58 +0300 |
commit | 86bccb71a1d4b3627d1a6a601ca0ee61dbc00760 (patch) | |
tree | 9018b54c0588806ae3eee1cfa5a46926e09c95c1 | |
parent | 8dce66234ffa27726bd2aa19db754d2f394c3e7c (diff) |
Create ref for every merge request. Add documentation for fetch merge requests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/models/merge_request_diff.rb | 4 | ||||
-rw-r--r-- | doc/workflow/merge_requests.md | 41 |
2 files changed, 43 insertions, 2 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 2177f972ca3..e317c8eac4d 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -161,8 +161,8 @@ class MergeRequestDiff < ActiveRecord::Base def compare_result @compare_result ||= begin - # Update ref if merge request is from fork - merge_request.fetch_ref if merge_request.for_fork? + # Update ref for merge request + merge_request.fetch_ref # Get latest sha of branch from source project source_sha = merge_request.source_project.commit(source_branch).sha diff --git a/doc/workflow/merge_requests.md b/doc/workflow/merge_requests.md new file mode 100644 index 00000000000..b1910e2a51c --- /dev/null +++ b/doc/workflow/merge_requests.md @@ -0,0 +1,41 @@ +# Merge Requests + +Merge requests allow you to exchange changes you made to source code + +## Checkout merge requests locally + + +Locate the section for your GitLab remote in the `.git/config` file. It looks like this: + +``` +[remote "origin"] + url = https://gitlab.com/gitlab-org/gitlab-ce.git + fetch = +refs/heads/*:refs/remotes/origin/* +``` + +Now add the line `fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*` to this section. + +It should looks like this: + +``` +[remote "origin"] + url = https://gitlab.com/gitlab-org/gitlab-ce.git + fetch = +refs/heads/*:refs/remotes/origin/* + fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/* +``` + +Now you can fetch all the merge requests requests: + +``` +$ git fetch origin +From https://gitlab.com/gitlab-org/gitlab-ce.git + * [new ref] refs/merge-requests/1/head -> origin/merge-requests/1 + * [new ref] refs/merge-requests/2/head -> origin/merge-requests/2 +... +``` + +To check out a particular merge request: + +``` +$ git checkout origin/merge-requests/1 +``` |