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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a30f278b
Commit
a30f278b
authored
Jan 06, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for initial commit and remove unneeded args
parent
ae86a1b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+9
-3
app/services/commits/change_service.rb
app/services/commits/change_service.rb
+9
-2
lib/api/commits.rb
lib/api/commits.rb
+0
-2
No files found.
app/controllers/concerns/creates_commit.rb
View file @
a30f278b
...
...
@@ -4,9 +4,10 @@ module CreatesCommit
def
create_commit
(
service
,
success_path
:,
failure_path
:,
failure_view:
nil
,
success_notice:
nil
)
set_commit_variables
source_branch
=
@mr_target_branch
unless
initial_commit?
commit_params
=
@commit_params
.
merge
(
source_project:
@mr_target_project
,
source_branch:
@mr_target
_branch
,
source_branch:
source
_branch
,
target_branch:
@mr_source_branch
)
...
...
@@ -113,7 +114,7 @@ module CreatesCommit
else
# Merge request to this project
@mr_target_project
=
@project
@mr_target_branch
||=
@ref
@mr_target_branch
=
@ref
||
@target_branch
end
else
# Edit file in fork
...
...
@@ -121,7 +122,12 @@ module CreatesCommit
# Merge request from fork to this project
@mr_source_project
=
@tree_edit_project
@mr_target_project
=
@project
@mr_target_branch
||=
@ref
@mr_target_branch
=
@ref
||
@target_branch
end
end
def
initial_commit?
@mr_target_branch
.
nil?
||
!
@mr_target_project
.
repository
.
branch_exists?
(
@mr_target_branch
)
end
end
app/services/commits/change_service.rb
View file @
a30f278b
...
...
@@ -26,8 +26,15 @@ module Commits
def
commit_change
(
action
)
raise
NotImplementedError
unless
repository
.
respond_to?
(
action
)
into
=
@create_merge_request
?
@commit
.
public_send
(
"
#{
action
}
_branch_name"
)
:
@target_branch
tree_id
=
repository
.
public_send
(
"check_
#{
action
}
_content"
,
@commit
,
@target_branch
)
if
@create_merge_request
into
=
@commit
.
public_send
(
"
#{
action
}
_branch_name"
)
tree_branch
=
@source_branch
else
into
=
tree_branch
=
@target_branch
end
tree_id
=
repository
.
public_send
(
"check_
#{
action
}
_content"
,
@commit
,
tree_branch
)
if
tree_id
validate_target_branch
(
into
)
if
@create_merge_request
...
...
lib/api/commits.rb
View file @
a30f278b
...
...
@@ -140,8 +140,6 @@ module API
commit_params
=
{
commit:
commit
,
create_merge_request:
false
,
source_project:
user_project
,
source_branch:
commit
.
cherry_pick_branch_name
,
target_branch:
params
[
:branch
]
}
...
...
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