diff --git a/app/models/repository.rb b/app/models/repository.rb
index 80b83720d27894eb60bb0cfe8770e83b53dab68b..c0138514c0ff587bdead9da6f1fd5c19946f1c28 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -748,8 +748,8 @@ class Repository
         update: options[:update]
       }
 
-      if commit_options[:previous_path]
-        commit_options[:file].merge!(previous_path: commit_options[:previous_path])
+      if options[:previous_path]
+        commit_options[:file][:previous_path] = options[:previous_path]
 
         Gitlab::Git::Blob.rename(raw_repository, commit_options)
       else