Commit b487a798 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'zj-ls-files-mandatory' into 'master'

Git ls files is Gitaly only now

Closes #47893 and gitaly#327

See merge request gitlab-org/gitlab-ce!20088
parents 9c321464 3247f47c
...@@ -946,13 +946,7 @@ module Gitlab ...@@ -946,13 +946,7 @@ module Gitlab
# #
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/327 # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/327
def ls_files(ref) def ls_files(ref)
gitaly_migrate(:ls_files) do |is_enabled| gitaly_commit_client.ls_files(ref)
if is_enabled
gitaly_ls_files(ref)
else
git_ls_files(ref)
end
end
end end
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/328 # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/328
...@@ -1836,33 +1830,6 @@ module Gitlab ...@@ -1836,33 +1830,6 @@ module Gitlab
gitaly_repository_client.repository_size gitaly_repository_client.repository_size
end end
def gitaly_ls_files(ref)
gitaly_commit_client.ls_files(ref)
end
def git_ls_files(ref)
actual_ref = ref || root_ref
begin
sha_from_ref(actual_ref)
rescue Rugged::OdbError, Rugged::InvalidError, Rugged::ReferenceError
# Return an empty array if the ref wasn't found
return []
end
cmd = %W(ls-tree -r --full-tree --full-name -- #{actual_ref})
raw_output, _status = run_git(cmd)
lines = raw_output.split("\n").map do |f|
stuff, path = f.split("\t")
_mode, type, _sha = stuff.split(" ")
path if type == "blob"
# Contain only blob type
end
lines.compact
end
# Returns true if the given ref name exists # Returns true if the given ref name exists
# #
# Ref names must start with `refs/`. # Ref names must start with `refs/`.
......
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