Skip to content
Snippets Groups Projects
Commit b1958385 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Valery Sizov
Browse files

Revert "Create and edit files in web editor via rugged"


This reverts commit 734a4ba8.

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent aeec708f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -364,53 +364,6 @@ def root_ref
@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})
Loading
Loading
Loading
Loading
@@ -33,24 +33,14 @@ def execute
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
Loading
Loading
Loading
Loading
@@ -19,23 +19,13 @@ def execute
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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment