diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb index 185ab26..1876dba 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 30e512d..bacd0cc 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 d59802a..19bd62e 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") -- libgit2 0.21.2