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

find the commit properly and replicate gitlab_git

by checking filename as well
parent cdb598f3
...@@ -860,7 +860,8 @@ class Repository ...@@ -860,7 +860,8 @@ class Repository
source_branch: source_branch, source_branch: source_branch,
source_project: source_project) do source_project: source_project) do
index = rugged.index index = rugged.index
branch_commit = find_branch(branch) branch_commit = source_project.repository.find_branch(
source_branch || branch)
parents = if branch_commit parents = if branch_commit
last_commit = branch_commit.dereferenced_target last_commit = branch_commit.dereferenced_target
...@@ -873,6 +874,9 @@ class Repository ...@@ -873,6 +874,9 @@ class Repository
actions.each do |action| actions.each do |action|
path = Gitlab::Git::PathHelper.normalize_path(action[:file_path]).to_s path = Gitlab::Git::PathHelper.normalize_path(action[:file_path]).to_s
raise Gitlab::Git::Repository::InvalidBlobName.new("Invalid path") if
path.split('/').include?('..')
case action[:action] case action[:action]
when :create, :update, :move when :create, :update, :move
mode = mode =
......
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