Commit 9bc51231 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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 08066059
...@@ -784,6 +784,7 @@ DEPENDENCIES ...@@ -784,6 +784,7 @@ DEPENDENCIES
gitlab-linguist (~> 3.0.1) gitlab-linguist (~> 3.0.1)
gitlab_emoji (~> 0.1) gitlab_emoji (~> 0.1)
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD <<<<<<< HEAD
gitlab_git (~> 7.2.6) gitlab_git (~> 7.2.6)
======= =======
...@@ -792,6 +793,9 @@ DEPENDENCIES ...@@ -792,6 +793,9 @@ DEPENDENCIES
======= =======
gitlab_git (~> 7.2.0) gitlab_git (~> 7.2.0)
>>>>>>> parent of 27a1585... Fix adding new file to empty repo >>>>>>> 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_meta (= 7.0)
gitlab_omniauth-ldap (= 1.2.1) gitlab_omniauth-ldap (= 1.2.1)
gollum-lib (~> 4.0.2) gollum-lib (~> 4.0.2)
......
...@@ -364,53 +364,6 @@ class Repository ...@@ -364,53 +364,6 @@ class Repository
@root_ref ||= raw_repository.root_ref @root_ref ||= raw_repository.root_ref
end 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) def search_files(query, ref)
offset = 2 offset = 2
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref}) args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref})
......
...@@ -33,24 +33,14 @@ module Files ...@@ -33,24 +33,14 @@ module Files
end end
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 if created_successfully
success success
......
...@@ -19,23 +19,13 @@ module Files ...@@ -19,23 +19,13 @@ module Files
return error("You can only edit text files") return error("You can only edit text files")
end end
if params[:encoding] == 'base64' edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, project, ref, path)
edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, project, ref, path) edit_file_action.commit!(
edit_file_action.commit!( params[:content],
params[:content], params[:commit_message],
params[:commit_message], params[:encoding],
params[:encoding], params[:new_branch]
params[:new_branch] )
)
else
repository.commit_file(
current_user,
path,
params[:content],
params[:commit_message],
params[:new_branch] || ref
)
end
success success
rescue Gitlab::Satellite::CheckoutFailed => ex rescue Gitlab::Satellite::CheckoutFailed => ex
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment