BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9bc51231
Unverified
Commit
9bc51231
authored
Aug 11, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Create and edit files in web editor via rugged"
This reverts commit
734a4ba8
. Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
08066059
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
81 deletions
+18
-81
Gemfile.lock
Gemfile.lock
+4
-0
repository.rb
app/models/repository.rb
+0
-47
create_service.rb
app/services/files/create_service.rb
+7
-17
update_service.rb
app/services/files/update_service.rb
+7
-17
No files found.
Gemfile.lock
View file @
9bc51231
...
...
@@ -785,6 +785,7 @@ DEPENDENCIES
gitlab_emoji (~> 0.1)
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
gitlab_git (~> 7.2.6)
=======
gitlab_git (~> 7.2.2)
...
...
@@ -792,6 +793,9 @@ DEPENDENCIES
=======
gitlab_git (~> 7.2.0)
>>>>>>> parent of 27a1585... Fix adding new file to empty repo
=======
gitlab_git (~> 7.1.13)
>>>>>>> parent of 734a4ba... Create and edit files in web editor via rugged
gitlab_meta (= 7.0)
gitlab_omniauth-ldap (= 1.2.1)
gollum-lib (~> 4.0.2)
...
...
app/models/repository.rb
View file @
9bc51231
...
...
@@ -364,53 +364,6 @@ class Repository
@root_ref
||=
raw_repository
.
root_ref
end
def
commit_file
(
user
,
path
,
content
,
message
,
ref
)
path
[
0
]
=
''
if
path
[
0
]
==
'/'
committer
=
user_to_comitter
(
user
)
options
=
{}
options
[
:committer
]
=
committer
options
[
:author
]
=
committer
options
[
:commit
]
=
{
message:
message
,
branch:
ref
}
options
[
:file
]
=
{
content:
content
,
path:
path
}
Gitlab
::
Git
::
Blob
.
commit
(
raw_repository
,
options
)
end
def
remove_file
(
user
,
path
,
message
,
ref
)
path
[
0
]
=
''
if
path
[
0
]
==
'/'
committer
=
user_to_comitter
(
user
)
options
=
{}
options
[
:committer
]
=
committer
options
[
:author
]
=
committer
options
[
:commit
]
=
{
message:
message
,
branch:
ref
}
options
[
:file
]
=
{
path:
path
}
Gitlab
::
Git
::
Blob
.
remove
(
raw_repository
,
options
)
end
def
user_to_comitter
(
user
)
{
email:
user
.
email
,
name:
user
.
name
,
time:
Time
.
now
}
end
def
search_files
(
query
,
ref
)
offset
=
2
args
=
%W(git grep -i -n --before-context
#{
offset
}
--after-context
#{
offset
}
#{
query
}
#{
ref
||
root_ref
}
)
...
...
app/services/files/create_service.rb
View file @
9bc51231
...
...
@@ -33,24 +33,14 @@ module Files
end
end
if
params
[
:encoding
]
==
'base64'
new_file_action
=
Gitlab
::
Satellite
::
NewFileAction
.
new
(
current_user
,
project
,
ref
,
file_path
)
created_successfully
=
new_file_action
.
commit!
(
params
[
:content
],
params
[
:commit_message
],
params
[
:encoding
],
params
[
:new_branch
]
)
else
created_successfull
=
repository
.
commit_file
(
current_user
,
file_path
,
params
[
:content
],
params
[
:commit_message
],
params
[
:new_branch
]
||
ref
)
end
new_file_action
=
Gitlab
::
Satellite
::
NewFileAction
.
new
(
current_user
,
project
,
ref
,
file_path
)
created_successfully
=
new_file_action
.
commit!
(
params
[
:content
],
params
[
:commit_message
],
params
[
:encoding
],
params
[
:new_branch
]
)
if
created_successfully
success
...
...
app/services/files/update_service.rb
View file @
9bc51231
...
...
@@ -19,23 +19,13 @@ module Files
return
error
(
"You can only edit text files"
)
end
if
params
[
:encoding
]
==
'base64'
edit_file_action
=
Gitlab
::
Satellite
::
EditFileAction
.
new
(
current_user
,
project
,
ref
,
path
)
edit_file_action
.
commit!
(
params
[
:content
],
params
[
:commit_message
],
params
[
:encoding
],
params
[
:new_branch
]
)
else
repository
.
commit_file
(
current_user
,
path
,
params
[
:content
],
params
[
:commit_message
],
params
[
:new_branch
]
||
ref
)
end
edit_file_action
=
Gitlab
::
Satellite
::
EditFileAction
.
new
(
current_user
,
project
,
ref
,
path
)
edit_file_action
.
commit!
(
params
[
:content
],
params
[
:commit_message
],
params
[
:encoding
],
params
[
:new_branch
]
)
success
rescue
Gitlab
::
Satellite
::
CheckoutFailed
=>
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