Commit b2700e64 authored by Douwe Maan's avatar Douwe Maan

Merge branch '22303-symbolic-in-tree' into 'master'

#22303 fix mode representation git::tree ( in base 8 )

Closes #22303

See merge request !9780
parents 2fceb437 ed5d59d4
---
title: Fix symlink icon in project tree
merge_request: 9780
author: mhasbini
...@@ -204,7 +204,7 @@ module API ...@@ -204,7 +204,7 @@ module API
expose :id, :name, :type, :path expose :id, :name, :type, :path
expose :mode do |obj, options| expose :mode do |obj, options|
filemode = obj.mode.to_s(8) filemode = obj.mode
filemode = "0" + filemode if filemode.length < 6 filemode = "0" + filemode if filemode.length < 6
filemode filemode
end end
......
...@@ -33,7 +33,7 @@ module Gitlab ...@@ -33,7 +33,7 @@ module Gitlab
root_id: root_tree.oid, root_id: root_tree.oid,
name: entry[:name], name: entry[:name],
type: entry[:type], type: entry[:type],
mode: entry[:filemode], mode: entry[:filemode].to_s(8),
path: path ? File.join(path, entry[:name]) : entry[:name], path: path ? File.join(path, entry[:name]) : entry[:name],
commit_id: sha, commit_id: sha,
) )
......
...@@ -19,6 +19,7 @@ describe Gitlab::Git::Tree, seed_helper: true do ...@@ -19,6 +19,7 @@ describe Gitlab::Git::Tree, seed_helper: true do
it { expect(dir.commit_id).to eq(SeedRepo::Commit::ID) } it { expect(dir.commit_id).to eq(SeedRepo::Commit::ID) }
it { expect(dir.name).to eq('encoding') } it { expect(dir.name).to eq('encoding') }
it { expect(dir.path).to eq('encoding') } it { expect(dir.path).to eq('encoding') }
it { expect(dir.mode).to eq('40000') }
context :subdir do context :subdir do
let(:subdir) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files').first } let(:subdir) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files').first }
......
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