Commit 51334904 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'zj-gitaly-squash' into 'master'

Rebase and Squash in progress are Gitaly only

Closes gitaly#865 and gitaly#1018

See merge request gitlab-org/gitlab-ce!19987
parents 14dda26b 5053dc84
...@@ -1222,12 +1222,8 @@ module Gitlab ...@@ -1222,12 +1222,8 @@ module Gitlab
end end
def rebase_in_progress?(rebase_id) def rebase_in_progress?(rebase_id)
gitaly_migrate(:rebase_in_progress) do |is_enabled| wrapped_gitaly_errors do
if is_enabled
gitaly_repository_client.rebase_in_progress?(rebase_id) gitaly_repository_client.rebase_in_progress?(rebase_id)
else
fresh_worktree?(worktree_path(REBASE_WORKTREE_PREFIX, rebase_id))
end
end end
end end
...@@ -1243,12 +1239,8 @@ module Gitlab ...@@ -1243,12 +1239,8 @@ module Gitlab
end end
def squash_in_progress?(squash_id) def squash_in_progress?(squash_id)
gitaly_migrate(:squash_in_progress, status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled| wrapped_gitaly_errors do
if is_enabled
gitaly_repository_client.squash_in_progress?(squash_id) gitaly_repository_client.squash_in_progress?(squash_id)
else
fresh_worktree?(worktree_path(SQUASH_WORKTREE_PREFIX, squash_id))
end
end end
end end
...@@ -1591,21 +1583,6 @@ module Gitlab ...@@ -1591,21 +1583,6 @@ module Gitlab
end end
end end
# This function is duplicated in Gitaly-Go, don't change it!
# https://gitlab.com/gitlab-org/gitaly/merge_requests/698
def fresh_worktree?(path)
File.exist?(path) && !clean_stuck_worktree(path)
end
# This function is duplicated in Gitaly-Go, don't change it!
# https://gitlab.com/gitlab-org/gitaly/merge_requests/698
def clean_stuck_worktree(path)
return false unless File.mtime(path) < 15.minutes.ago
FileUtils.rm_rf(path)
true
end
# Adding a worktree means checking out the repository. For large repos, # Adding a worktree means checking out the repository. For large repos,
# this can be very expensive, so set up sparse checkout for the worktree # this can be very expensive, so set up sparse checkout for the worktree
# to only check out the files we're interested in. # to only check out the files we're interested in.
......
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