Commit 489d8e11 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab) Committed by Rémy Coutable

Vendor the gitlab-git-test repo

parent 5dd6d9a9
......@@ -550,3 +550,9 @@ cache gems:
only:
- master@gitlab-org/gitlab-ce
- master@gitlab-org/gitlab-ee
gitlab_git_test:
variables:
SETUP_DB: "false"
script:
- spec/support/prepare-gitlab-git-test-for-commit --check-for-changes
......@@ -15,7 +15,7 @@
require 'erb'
require 'tempfile'
SOURCE = 'https://gitlab.com/gitlab-org/gitlab-git-test.git'.freeze
SOURCE = File.expand_path('../gitlab-git-test.git', __FILE__).freeze
SCRIPT_NAME = 'generate-seed-repo-rb'.freeze
REPO_NAME = 'gitlab-git-test.git'.freeze
......
# Gitlab::Git test repository
This repository is used by (some of) the tests in spec/lib/gitlab/git.
Do not add new large files to this repository. Otherwise we needlessly
inflate the size of the gitlab-ce repository.
## How to make changes to this repository
- (if needed) clone `https://gitlab.com/gitlab-org/gitlab-ce.git` to your local machine
- clone `gitlab-ce/spec/support/gitlab-git-test.git` locally (i.e. clone from your hard drive, not from the internet)
- make changes in your local clone of gitlab-git-test
- run `git push` which will push to your local source `gitlab-ce/spec/support/gitlab-git-test.git`
- in gitlab-ce: run `spec/support/prepare-gitlab-git-test-for-commit`
- in gitlab-ce: `git add spec/support/seed_repo.rb spec/support/gitlab-git-test.git`
- commit your changes in gitlab-ce
[core]
repositoryformatversion = 0
filemode = true
bare = true
precomposeunicode = true
[remote "origin"]
url = https://gitlab.com/gitlab-org/gitlab-git-test.git
# pack-refs with: peeled fully-peeled
0b4bc9a49b562e85de7cc9e834518ea6828729b9 refs/heads/feature
12d65c8dd2b2676fa3ac47d955accc085a37a9c1 refs/heads/fix
6473c90867124755509e100d0d35ebdc85a0b6ae refs/heads/fix-blob-path
58fa1a3af4de73ea83fe25a1ef1db8e0c56f67e5 refs/heads/fix-existing-submodule-dir
40f4a7a617393735a95a0bb67b08385bc1e7c66d refs/heads/fix-mode
9abd6a8c113a2dd76df3fdb3d58a8cec6db75f8d refs/heads/gitattributes
46e1395e609395de004cacd4b142865ab0e52a29 refs/heads/gitattributes-updated
4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6 refs/heads/master
5937ac0a7beb003549fc5fd26fc247adbce4a52e refs/heads/merge-test
f4e6814c3e4e7a0de82a9e7cd20c626cc963a2f8 refs/tags/v1.0.0
^6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9
8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b refs/tags/v1.1.0
^5937ac0a7beb003549fc5fd26fc247adbce4a52e
10d64eed7760f2811ee2d64b44f1f7d3b364f17b refs/tags/v1.2.0
^eb49186cfa5c4338011f5f590fac11bd66c5c631
2ac1f24e253e08135507d0830508febaaccf02ee refs/tags/v1.2.1
^fa1b1e6c004a68b7d8763b86455da9e6b23e36d6
#!/usr/bin/env ruby
abort unless [
system('spec/support/generate-seed-repo-rb', out: 'spec/support/seed_repo.rb'),
system('spec/support/unpack-gitlab-git-test')
].all?
exit if ARGV.first != '--check-for-changes'
git_status = IO.popen(%w[git status --porcelain], &:read)
abort unless $?.success?
puts git_status
if git_status.lines.grep(%r{^.. spec/support/gitlab-git-test.git}).any?
abort "error: detected changes in gitlab-git-test.git"
end
......@@ -9,7 +9,7 @@ TEST_MUTABLE_REPO_PATH = 'mutable-repo.git'.freeze
TEST_BROKEN_REPO_PATH = 'broken-repo.git'.freeze
module SeedHelper
GITLAB_GIT_TEST_REPO_URL = ENV.fetch('GITLAB_GIT_TEST_REPO_URL', 'https://gitlab.com/gitlab-org/gitlab-git-test.git').freeze
GITLAB_GIT_TEST_REPO_URL = File.expand_path('../gitlab-git-test.git', __FILE__).freeze
def ensure_seeds
if File.exist?(SEED_STORAGE_PATH)
......
#!/usr/bin/env ruby
require 'fileutils'
REPO = 'spec/support/gitlab-git-test.git'.freeze
PACK_DIR = REPO + '/objects/pack'
GIT = %W[git --git-dir=#{REPO}].freeze
BASE_PACK = 'pack-691247af2a6acb0b63b73ac0cb90540e93614043'.freeze
def main
unpack
# We want to store the refs in a packed-refs file because if we don't
# they can get mangled by filesystems.
abort unless system(*GIT, *%w[pack-refs --all])
abort unless system(*GIT, 'fsck')
end
# We don't want contributors to commit new pack files because those
# create unnecessary churn.
def unpack
pack_files = Dir[File.join(PACK_DIR, '*')].reject do |pack|
pack.start_with?(File.join(PACK_DIR, BASE_PACK))
end
return if pack_files.empty?
pack_files.each do |pack|
unless pack.end_with?('.pack')
FileUtils.rm(pack)
next
end
File.open(pack, 'rb') do |open_pack|
File.unlink(pack)
abort unless system(*GIT, 'unpack-objects', in: open_pack)
end
end
end
main
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