diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2018-08-16 12:01:36 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2018-08-16 12:01:36 +0300 |
commit | 3a8dab78c2e4af77940e6cc82c6732060c684dba (patch) | |
tree | a0a965e137d6eafcdb07738fa0f8dda8e57f2a70 | |
parent | 153732672b822722f49cf2fe2b241a715c18a5be (diff) |
Vendor Gitlab::Git at c87ca832263
-rwxr-xr-x | _support/vendor-gitlab-git | 1 | ||||
-rw-r--r-- | changelogs/unreleased/zj-vendor-gitlab-git-20180815.yml | 5 | ||||
-rw-r--r-- | ruby/vendor/gitlab_git/REVISION | 2 | ||||
-rw-r--r-- | ruby/vendor/gitlab_git/lib/gitlab/git.rb | 8 | ||||
-rw-r--r-- | ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb | 33 |
5 files changed, 23 insertions, 26 deletions
diff --git a/_support/vendor-gitlab-git b/_support/vendor-gitlab-git index 19f9a6666..7d0a5e78f 100755 --- a/_support/vendor-gitlab-git +++ b/_support/vendor-gitlab-git @@ -24,6 +24,7 @@ EXCLUDE = %w[ lib/gitlab/git/index.rb lib/gitlab/git/lfs_changes.rb lib/gitlab/git/lfs_pointer_file.rb + lib/gitlab/git/merge_base.rb lib/gitlab/git/rev_list.rb lib/gitlab/git/storage/ lib/gitlab/git/storage.rb diff --git a/changelogs/unreleased/zj-vendor-gitlab-git-20180815.yml b/changelogs/unreleased/zj-vendor-gitlab-git-20180815.yml new file mode 100644 index 000000000..a91917fd0 --- /dev/null +++ b/changelogs/unreleased/zj-vendor-gitlab-git-20180815.yml @@ -0,0 +1,5 @@ +--- +title: Vendor Gitlab::Git at c87ca832263 +merge_request: 860 +author: +type: other diff --git a/ruby/vendor/gitlab_git/REVISION b/ruby/vendor/gitlab_git/REVISION index 48e55c453..85c7be410 100644 --- a/ruby/vendor/gitlab_git/REVISION +++ b/ruby/vendor/gitlab_git/REVISION @@ -1 +1 @@ -2ca8219a20f16636b7a0ffa899a1a04ab8e84782 +c87ca8322636db69b6f097336f163d0373bb415e diff --git a/ruby/vendor/gitlab_git/lib/gitlab/git.rb b/ruby/vendor/gitlab_git/lib/gitlab/git.rb index 55236a112..2913a3e41 100644 --- a/ruby/vendor/gitlab_git/lib/gitlab/git.rb +++ b/ruby/vendor/gitlab_git/lib/gitlab/git.rb @@ -10,9 +10,11 @@ module Gitlab TAG_REF_PREFIX = "refs/tags/".freeze BRANCH_REF_PREFIX = "refs/heads/".freeze - CommandError = Class.new(StandardError) - CommitError = Class.new(StandardError) - OSError = Class.new(StandardError) + BaseError = Class.new(StandardError) + CommandError = Class.new(BaseError) + CommitError = Class.new(BaseError) + OSError = Class.new(BaseError) + UnknownRef = Class.new(BaseError) class << self include Gitlab::EncodingHelper diff --git a/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb b/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb index eb02c7ac8..e9c901f85 100644 --- a/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb +++ b/ruby/vendor/gitlab_git/lib/gitlab/git/repository.rb @@ -19,6 +19,7 @@ module Gitlab GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE ].freeze 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) @@ -39,19 +40,6 @@ module Gitlab ChecksumError = Class.new(StandardError) class << self - # Unlike `new`, `create` takes the repository path - def create(repo_path, bare: true, symlink_hooks_to: nil) - FileUtils.mkdir_p(repo_path, mode: 0770) - - # Equivalent to `git --git-path=#{repo_path} init [--bare]` - repo = Rugged::Repository.init_at(repo_path, bare) - repo.close - - create_hooks(repo_path, symlink_hooks_to) if symlink_hooks_to.present? - - true - end - def create_hooks(repo_path, global_hooks_path) local_hooks_path = File.join(repo_path, 'hooks') real_local_hooks_path = :not_found @@ -378,17 +366,18 @@ module Gitlab end end - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1233 def new_commits(newrev) - gitaly_migrate(:new_commits) do |is_enabled| - if is_enabled - gitaly_ref_client.list_new_commits(newrev) - else - refs = Gitlab::GitalyClient::StorageSettings.allow_disk_access do - rev_list(including: newrev, excluding: :all).split("\n").map(&:strip) - end + wrapped_gitaly_errors do + gitaly_ref_client.list_new_commits(newrev) + end + end + + def new_blobs(newrev) + return [] if newrev.blank? || newrev == ::Gitlab::Git::BLANK_SHA - Gitlab::Git::Commit.batch_by_oid(self, refs) + strong_memoize("new_blobs_#{newrev}") do + wrapped_gitaly_errors do + gitaly_ref_client.list_new_blobs(newrev, REV_LIST_COMMIT_LIMIT) end end end |