diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-05 09:02:13 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-05 09:02:13 +0200 |
commit | fc16a228c915437e17dc040e2798c26acac8fd86 (patch) | |
tree | a273c36de81f2b2d8b23c02513061ab66b659640 /app/services/files | |
parent | 31987259e4c1d878bb796d07e5594156dbcfac5c (diff) | |
download | gitlab-ce-fc16a228c915437e17dc040e2798c26acac8fd86.tar.gz |
Fix blobs for file services
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services/files')
-rw-r--r-- | app/services/files/create_service.rb | 3 | ||||
-rw-r--r-- | app/services/files/delete_service.rb | 3 | ||||
-rw-r--r-- | app/services/files/update_service.rb | 3 |
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") |