diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-12-08 01:30:10 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-12-08 01:30:10 +0800 |
commit | e36088dd98c1c00a8884684158d47f479940346e (patch) | |
tree | 1c4b7e5aa28227ec757ea5581b1c6d82c90e22cd /app/models | |
parent | 4b3c18ce5cbd88156423d89f26b0869f45e2225e (diff) | |
download | gitlab-ce-e36088dd98c1c00a8884684158d47f479940346e.tar.gz |
We need to normalize the path for all actions
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 4d74ac6f585..cf2c08f618e 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -766,7 +766,7 @@ class Repository commit_file( user, - "#{Gitlab::Git::PathHelper.normalize_path(path)}/.gitkeep", + "#{path}/.gitkeep", '', message, branch, @@ -871,12 +871,14 @@ class Repository end actions.each do |action| + path = Gitlab::Git::PathHelper.normalize_path(action[:file_path]).to_s + case action[:action] when :create, :update, :move mode = case action[:action] when :update - index.get(action[:file_path])[:mode] + index.get(path)[:mode] when :move index.get(action[:previous_path])[:mode] end @@ -887,9 +889,9 @@ class Repository content = action[:encoding] == 'base64' ? Base64.decode64(action[:content]) : action[:content] oid = rugged.write(content, :blob) - index.add(path: action[:file_path], oid: oid, mode: mode) + index.add(path: path, oid: oid, mode: mode) when :delete - index.remove(action[:file_path]) + index.remove(path) end end |