Commit 3fe07ce7 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'jc-update-list-last-commits' into 'master'

Client side changes for ListLastCommitsForTree response update

See merge request gitlab-org/gitlab-ce!26880
parents f3b3d8b1 2370e5d0
1.34.0
1.35.0
\ No newline at end of file
---
title: Client side changes for ListLastCommitsForTree response update
merge_request: 26880
author:
type: fixed
......@@ -174,7 +174,7 @@ module Gitlab
response.each_with_object({}) do |gitaly_response, hsh|
gitaly_response.commits.each do |commit_for_tree|
hsh[commit_for_tree.path] = Gitlab::Git::Commit.new(@repository, commit_for_tree.commit)
hsh[commit_for_tree.path_bytes] = Gitlab::Git::Commit.new(@repository, commit_for_tree.commit)
end
end
end
......
......@@ -217,6 +217,25 @@ describe Repository do
expect(result.size).to eq(0)
end
context 'with a commit with invalid UTF-8 path' do
def create_commit_with_invalid_utf8_path
rugged = rugged_repo(repository)
blob_id = Rugged::Blob.from_buffer(rugged, "some contents")
tree_builder = Rugged::Tree::Builder.new(rugged)
tree_builder.insert({ oid: blob_id, name: "hello\x80world", filemode: 0100644 })
tree_id = tree_builder.write
user = { email: "jcai@gitlab.com", time: Time.now, name: "John Cai" }
Rugged::Commit.create(rugged, message: 'some commit message', parents: [rugged.head.target.oid], tree: tree_id, committer: user, author: user)
end
it 'does not raise an error' do
commit = create_commit_with_invalid_utf8_path
expect { repository.list_last_commits_for_tree(commit, '.', offset: 0) }.not_to raise_error
end
end
end
describe '#last_commit_for_path' do
......
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