From e7b54b9cb8c494f97a48e170696e5d56065aea31 Mon Sep 17 00:00:00 2001 From: GitalyBot Date: Tue, 25 Jun 2019 14:45:51 +0000 Subject: Fix broken worktree test The setup was wrong, and due to Gitaly being a bit more strict it had to match up. The test is now accurate and passing again. --- GITALY_SERVER_VERSION | 2 +- changelogs/unreleased/gitaly-version-v1.49.0.yml | 5 +++++ lib/gitlab/git/repository.rb | 5 ----- spec/lib/gitlab/git/repository_spec.rb | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 changelogs/unreleased/gitaly-version-v1.49.0.yml diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 9db5ea12f52..7f3a46a841e 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -1.48.0 +1.49.0 diff --git a/changelogs/unreleased/gitaly-version-v1.49.0.yml b/changelogs/unreleased/gitaly-version-v1.49.0.yml new file mode 100644 index 00000000000..8795bab0209 --- /dev/null +++ b/changelogs/unreleased/gitaly-version-v1.49.0.yml @@ -0,0 +1,5 @@ +--- +title: Upgrade to Gitaly v1.49.0 +merge_request: 29990 +author: +type: changed diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index a6739f12280..19b6aab1c4f 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -15,11 +15,6 @@ module Gitlab SEARCH_CONTEXT_LINES = 3 REV_LIST_COMMIT_LIMIT = 2_000 - # In https://gitlab.com/gitlab-org/gitaly/merge_requests/698 - # We copied these two prefixes into gitaly-go, so don't change these - # or things will break! (REBASE_WORKTREE_PREFIX and SQUASH_WORKTREE_PREFIX) - REBASE_WORKTREE_PREFIX = 'rebase'.freeze - SQUASH_WORKTREE_PREFIX = 'squash'.freeze GITALY_INTERNAL_URL = 'ssh://gitaly/internal.git'.freeze GITLAB_PROJECTS_TIMEOUT = Gitlab.config.gitlab_shell.git_timeout EMPTY_REPOSITORY_CHECKSUM = '0000000000000000000000000000000000000000'.freeze diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index e72fb9c6fbc..cceeae8afe6 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -2038,24 +2038,24 @@ describe Gitlab::Git::Repository, :seed_helper do end describe '#clean_stale_repository_files' do - let(:worktree_path) { File.join(repository_path, 'worktrees', 'delete-me') } + let(:worktree_id) { 'rebase-1' } + let(:gitlab_worktree_path) { File.join(repository_path, 'gitlab-worktree', worktree_id) } + let(:admin_dir) { File.join(repository_path, 'worktrees') } it 'cleans up the files' do - create_worktree = %W[git -C #{repository_path} worktree add --detach #{worktree_path} master] + create_worktree = %W[git -C #{repository_path} worktree add --detach #{gitlab_worktree_path} master] raise 'preparation failed' unless system(*create_worktree, err: '/dev/null') - FileUtils.touch(worktree_path, mtime: Time.now - 8.hours) + FileUtils.touch(gitlab_worktree_path, mtime: Time.now - 8.hours) # git rev-list --all will fail in git 2.16 if HEAD is pointing to a non-existent object, # but the HEAD must be 40 characters long or git will ignore it. - File.write(File.join(worktree_path, 'HEAD'), Gitlab::Git::BLANK_SHA) - - # git 2.16 fails with "fatal: bad object HEAD" - expect(rev_list_all).to be false + File.write(File.join(admin_dir, worktree_id, 'HEAD'), Gitlab::Git::BLANK_SHA) + expect(rev_list_all).to be(false) repository.clean_stale_repository_files - expect(rev_list_all).to be true - expect(File.exist?(worktree_path)).to be_falsey + expect(rev_list_all).to be(true) + expect(File.exist?(gitlab_worktree_path)).to be_falsey end def rev_list_all -- cgit v1.2.1