Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/services/files/create_service.rb3
-rw-r--r--app/services/files/delete_service.rb3
-rw-r--r--app/services/files/update_service.rb3
3 files changed, 6 insertions, 3 deletions
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb
index 185ab26d96b..1876dba0887 100644
--- a/app/services/files/create_service.rb
+++ b/app/services/files/create_service.rb
@@ -24,7 +24,8 @@ module Files
return error("Your changes could not be committed, because file name contains not allowed characters")
end
- blob = repository.blob_at(ref, file_path)
+ commit = repository.commit(ref)
+ blob = repository.blob_at(commit.sha, file_path)
if blob
return error("Your changes could not be committed, because file with such name exists")
diff --git a/app/services/files/delete_service.rb b/app/services/files/delete_service.rb
index 30e512d0912..bacd0ccc5fb 100644
--- a/app/services/files/delete_service.rb
+++ b/app/services/files/delete_service.rb
@@ -17,7 +17,8 @@ module Files
return error("You can only create files if you are on top of a branch")
end
- blob = repository.blob_at(ref, path)
+ commit = repository.commit(ref)
+ blob = repository.blob_at(commit.sha, path)
unless blob
return error("You can only edit text files")
diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb
index d59802ae485..19bd62e1e36 100644
--- a/app/services/files/update_service.rb
+++ b/app/services/files/update_service.rb
@@ -17,7 +17,8 @@ module Files
return error("You can only create files if you are on top of a branch")
end
- blob = repository.blob_at(ref, path)
+ commit = repository.commit(ref)
+ blob = repository.blob_at(commit.sha, path)
unless blob
return error("You can only edit text files")