diff options
| author | Robert Speicher <robert@gitlab.com> | 2018-02-01 19:46:32 +0000 |
|---|---|---|
| committer | Robert Speicher <robert@gitlab.com> | 2018-02-01 19:46:32 +0000 |
| commit | 2793e3e1cc0697ccd386d681859bf70d77ec7fe9 (patch) | |
| tree | 17ce1bc8962b4368780ab0a2eef069de8e848c05 /spec/lib | |
| parent | 9e239f309d13facd9330983ddbe258d673746b62 (diff) | |
| parent | 28bbb4cb47ebb8669643e8fad34b75ea34f18e36 (diff) | |
| download | gitlab-ce-2793e3e1cc0697ccd386d681859bf70d77ec7fe9.tar.gz | |
Merge branch 'gitaly-970-repo-write-config' into 'master'
Migrate Gitlab::Git::Repository#write_config to Gitaly
Closes gitaly#970
See merge request gitlab-org/gitlab-ce!16730
Diffstat (limited to 'spec/lib')
| -rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index d4f56a41d9a..8e0ebb1f6fa 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1752,6 +1752,44 @@ describe Gitlab::Git::Repository, seed_helper: true do end end + describe '#write_config' do + before do + repository.rugged.config["gitlab.fullpath"] = repository.path + end + + shared_examples 'writing repo config' do + context 'is given a path' do + it 'writes it to disk' do + repository.write_config(full_path: "not-the/real-path.git") + + config = File.read(File.join(repository.path, "config")) + + expect(config).to include("[gitlab]") + expect(config).to include("fullpath = not-the/real-path.git") + end + end + + context 'it is given an empty path' do + it 'does not write it to disk' do + repository.write_config(full_path: "") + + config = File.read(File.join(repository.path, "config")) + + expect(config).to include("[gitlab]") + expect(config).to include("fullpath = #{repository.path}") + end + end + end + + context "when gitaly_write_config is enabled" do + it_behaves_like "writing repo config" + end + + context "when gitaly_write_config is disabled", :disable_gitaly do + it_behaves_like "writing repo config" + end + end + describe '#merge' do let(:repository) do Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '') |
