Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[match] git storage: allow simultaneous usage of clone_branch_directly and shallow_clone #21716

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions match/lib/match/storage/git_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,14 @@ def download
command << " -c http.extraheader='Authorization: Bearer #{self.git_bearer_authorization}'" unless self.git_bearer_authorization.nil?

if self.shallow_clone
command << " --depth 1 --no-single-branch"
elsif self.clone_branch_directly
command << " --depth 1"
end

if self.clone_branch_directly
command += " -b #{self.branch.shellescape} --single-branch"
elsif self.shallow_clone
# shallow clone all branches if not cloning branch directly
command += " --no-single-branch"
end

command = command_from_private_key(command) unless self.git_private_key.nil?
Expand Down
Loading