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
Boxiang Sun
gitlab-ce
Commits
a51f26e5
Commit
a51f26e5
authored
Dec 08, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use commit_file for commit_dir
parent
fff3c526
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
app/models/repository.rb
app/models/repository.rb
+24
-14
No files found.
app/models/repository.rb
View file @
a51f26e5
...
...
@@ -749,22 +749,32 @@ class Repository
user
,
path
,
message
,
branch
,
author_email:
nil
,
author_name:
nil
,
source_branch:
nil
,
source_project:
project
)
GitOperationService
.
new
(
user
,
self
).
with_branch
(
if
branch_exists?
(
branch
)
# tree_entry is private
entry
=
raw_repository
.
send
(
:tree_entry
,
commit
(
branch
),
path
)
if
entry
if
entry
[
:type
]
==
:blob
raise
Gitlab
::
Git
::
Repository
::
InvalidBlobName
.
new
(
"Directory already exists as a file"
)
else
raise
Gitlab
::
Git
::
Repository
::
InvalidBlobName
.
new
(
"Directory already exists"
)
end
end
end
commit_file
(
user
,
"
#{
Gitlab
::
Git
::
PathHelper
.
normalize_path
(
path
)
}
/.gitkeep"
,
''
,
message
,
branch
,
false
,
author_email:
author_email
,
author_name:
author_name
,
source_branch:
source_branch
,
source_project:
source_project
)
do
|
ref
|
options
=
{
commit:
{
branch:
ref
,
message:
message
,
update_ref:
false
}
}
options
.
merge!
(
get_committer_and_author
(
user
,
email:
author_email
,
name:
author_name
))
raw_repository
.
mkdir
(
path
,
options
)
end
source_project:
source_project
)
end
# rubocop:enable Metrics/ParameterLists
...
...
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