Skip to content

Commit

Permalink
[match] git storage: allow simultaneous usage of clone_branch_directl…
Browse files Browse the repository at this point in the history
…y and shallow_clone (fastlane#21716)

* [match] combine clone_branch_directly and shallow_clone

* fix: typo

Co-authored-by: Roger Oba <rogerluan.oba@gmail.com>

* chore: refactor git_storage tests

* Remove parenthesis around "it" statements.

---------

Co-authored-by: Roger Oba <rogerluan.oba@gmail.com>
  • Loading branch information
2 people authored and SubhrajyotiSen committed Jan 17, 2024
1 parent f72d2af commit 18cb30c
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 206 deletions.
9 changes: 7 additions & 2 deletions match/lib/match/storage/git_storage.rb
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

0 comments on commit 18cb30c

Please sign in to comment.