Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/git/command_factory.go7
-rw-r--r--ruby/lib/gitlab/git/repository.rb16
2 files changed, 6 insertions, 17 deletions
diff --git a/internal/git/command_factory.go b/internal/git/command_factory.go
index 653bde385..9f9cb5c81 100644
--- a/internal/git/command_factory.go
+++ b/internal/git/command_factory.go
@@ -533,10 +533,9 @@ func (cf *ExecCommandFactory) SidecarGitConfiguration(ctx context.Context) ([]Co
}
// ... as well as all configuration that exists for specific Git subcommands. The sidecar
- // only executes git-symbolic-ref(1) and git-update-ref(1) nowadays, and this set of
- // commands is not expected to grow anymore. So while really intimate with how the sidecar
- // does this, it is good enough until we finally remove it.
- options = append(options, commandDescriptions["symbolic-ref"].opts...)
+ // only executes git-update-ref(1) nowadays, and this set of commands is not expected to
+ // grow anymore. So while really intimate with how the sidecar does this, it is good enough
+ // until we finally remove it.
options = append(options, commandDescriptions["update-ref"].opts...)
// Convert the `GlobalOption`s into `ConfigPair`s.
diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb
index b2b0c1fb9..cbe5bde19 100644
--- a/ruby/lib/gitlab/git/repository.rb
+++ b/ruby/lib/gitlab/git/repository.rb
@@ -250,25 +250,15 @@ module Gitlab
end
def head_symbolic_ref
- message, status = run_git(%w[symbolic-ref HEAD])
+ head = rugged.ref('HEAD')
- return 'main' if status.nonzero?
+ return 'main' if head.type != :symbolic
- Ref.extract_branch_name(message.squish)
+ Ref.extract_branch_name(head.target_id)
end
private
- def run_git(args, chdir: path, env: {}, nice: false, include_stderr: false, lazy_block: nil, &block)
- cmd = [Gitlab.config.git.bin_path, *args]
- cmd.unshift("nice") if nice
-
- object_directories = alternate_object_directories
- env['GIT_ALTERNATE_OBJECT_DIRECTORIES'] = object_directories.join(File::PATH_SEPARATOR) if object_directories.any?
-
- popen(cmd, chdir, env, include_stderr: include_stderr, lazy_block: lazy_block, &block)
- end
-
def branches_filter(filter: nil, sort_by: nil)
branches = rugged.branches.each(filter).map do |rugged_ref|
begin