Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
66ef5c1a
Commit
66ef5c1a
authored
Sep 25, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix satellites
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3bf316db
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
lib/gitlab/satellite/merge_action.rb
lib/gitlab/satellite/merge_action.rb
+14
-8
No files found.
lib/gitlab/satellite/merge_action.rb
View file @
66ef5c1a
...
@@ -65,15 +65,16 @@ module Gitlab
...
@@ -65,15 +65,16 @@ module Gitlab
prepare_satellite!
(
merge_repo
)
prepare_satellite!
(
merge_repo
)
update_satellite_source_and_target!
(
merge_repo
)
update_satellite_source_and_target!
(
merge_repo
)
if
merge_request
.
for_fork?
if
merge_request
.
for_fork?
# Only show what is new in the source branch compared to the target branch, not the other way around.
repository
=
Gitlab
::
Git
::
Repository
.
new
(
merge_repo
.
path
)
# The line below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
diffs
=
Gitlab
::
Git
::
Diff
.
between
(
# From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
repository
,
common_commit
=
merge_repo
.
git
.
native
(
:merge_base
,
default_options
,
[
"origin/
#{
merge_request
.
target_branch
}
"
,
"source/
#{
merge_request
.
source_branch
}
"
]).
strip
"source/
#{
merge_request
.
source_branch
}
"
,
diffs
=
merge_repo
.
diff
(
common_commit
,
"source/
#{
merge_request
.
source_branch
}
"
)
"origin/
#{
merge_request
.
target_branch
}
"
)
else
else
raise
"Attempt to determine diffs between for a non forked merge request in satellite MergeRequest.id:[
#{
merge_request
.
id
}
]"
raise
"Attempt to determine diffs between for a non forked merge request in satellite MergeRequest.id:[
#{
merge_request
.
id
}
]"
end
end
diffs
=
diffs
.
map
{
|
diff
|
Gitlab
::
Git
::
Diff
.
new
(
diff
)
}
return
diffs
return
diffs
end
end
rescue
Grit
::
Git
::
CommandFailed
=>
ex
rescue
Grit
::
Git
::
CommandFailed
=>
ex
...
@@ -97,11 +98,16 @@ module Gitlab
...
@@ -97,11 +98,16 @@ module Gitlab
prepare_satellite!
(
merge_repo
)
prepare_satellite!
(
merge_repo
)
update_satellite_source_and_target!
(
merge_repo
)
update_satellite_source_and_target!
(
merge_repo
)
if
(
merge_request
.
for_fork?
)
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
else
raise
"Attempt to determine commits between for a non forked merge request in satellite MergeRequest.id:[
#{
merge_request
.
id
}
]"
raise
"Attempt to determine commits between for a non forked merge request in satellite MergeRequest.id:[
#{
merge_request
.
id
}
]"
end
end
commits
=
commits
.
map
{
|
commit
|
Gitlab
::
Git
::
Commit
.
new
(
commit
,
nil
)
}
return
commits
return
commits
end
end
rescue
Grit
::
Git
::
CommandFailed
=>
ex
rescue
Grit
::
Git
::
CommandFailed
=>
ex
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment