Commit e36088dd authored by Lin Jen-Shin's avatar Lin Jen-Shin

We need to normalize the path for all actions

parent 4b3c18ce
...@@ -766,7 +766,7 @@ class Repository ...@@ -766,7 +766,7 @@ class Repository
commit_file( commit_file(
user, user,
"#{Gitlab::Git::PathHelper.normalize_path(path)}/.gitkeep", "#{path}/.gitkeep",
'', '',
message, message,
branch, branch,
...@@ -871,12 +871,14 @@ class Repository ...@@ -871,12 +871,14 @@ class Repository
end end
actions.each do |action| actions.each do |action|
path = Gitlab::Git::PathHelper.normalize_path(action[:file_path]).to_s
case action[:action] case action[:action]
when :create, :update, :move when :create, :update, :move
mode = mode =
case action[:action] case action[:action]
when :update when :update
index.get(action[:file_path])[:mode] index.get(path)[:mode]
when :move when :move
index.get(action[:previous_path])[:mode] index.get(action[:previous_path])[:mode]
end end
...@@ -887,9 +889,9 @@ class Repository ...@@ -887,9 +889,9 @@ class Repository
content = action[:encoding] == 'base64' ? Base64.decode64(action[:content]) : action[:content] content = action[:encoding] == 'base64' ? Base64.decode64(action[:content]) : action[:content]
oid = rugged.write(content, :blob) 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 when :delete
index.remove(action[:file_path]) index.remove(path)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment