CocoaPods / cocoapods-downloader

A small library that provides downloaders for various source types (HTTP/SVN/Git/Mercurial)
MIT License
84 stars 71 forks source link

Git shallow cloning is not used when branch is set #106

Open paiv opened 3 years ago

paiv commented 3 years ago

Report

What did you do?

bundle exec pod --verbose install

What did you expect to happen?

For Git dependencies, use --depth 1 when cloning.

What happened instead?

--depth 1 is not used:

% bundle exec pod --verbose install
  Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Example`: (``)

Fetching external sources
-> Pre-downloading: `YPImagePicker` from `https://github.com/Yummypets/YPImagePicker.git`, branch `bypass-compression`
  $ /opt/local/bin/git ls-remote https://github.com/Yummypets/YPImagePicker.git bypass-compression
  9fd06737d0ed9039ede045a85526d92477a8c562  refs/heads/bypass-compression
 > Git download
 > Git download
     $ /opt/local/bin/git clone https://github.com/Yummypets/YPImagePicker.git
     /var/folders/9v/8vsfgn095n58ypf76vmt6kjr0000gn/T/d20200814-84273-1nidkbq --template=
     Cloning into '/var/folders/9v/8vsfgn095n58ypf76vmt6kjr0000gn/T/d20200814-84273-1nidkbq'...

CocoaPods Environment

Stack

   CocoaPods : 1.10.0.beta.2
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.6 (19G73)
       Xcode : 11.6 (11E708)
         Git : git version 2.28.0
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /Users/user/Downloads/some-b/.bundle/ruby/2.6.0/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

platform :ios, '11.0'

target 'Example' do
  use_frameworks!

  pod 'YPImagePicker', :git => 'https://github.com/Yummypets/YPImagePicker.git', :branch => 'bypass-compression'
end
paiv commented 3 years ago

For default branch, shallow cloning is used:

pod 'YPImagePicker', :git => 'https://github.com/Yummypets/YPImagePicker.git'
% bundle exec pod --verbose install
  Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Example`: (``)

Fetching external sources
-> Pre-downloading: `YPImagePicker` from `https://github.com/Yummypets/YPImagePicker.git`
 > Git download
 > Git download
     $ /opt/local/bin/git clone https://github.com/Yummypets/YPImagePicker.git
     /var/folders/9v/8vsfgn095n58ypf76vmt6kjr0000gn/T/d20200814-84318-1mwgz3f --template= --single-branch --depth 1
     Cloning into '/var/folders/9v/8vsfgn095n58ypf76vmt6kjr0000gn/T/d20200814-84318-1mwgz3f'...

I've checked cocoapods-downloader, and it seems to handle branch and shallow cloning properly, so I suspect the issue is in how downloader is used.

dnkoutso commented 3 years ago

Yes going to transfer in that repo. Want to try to make a PR for it?

dimohamdy commented 3 years ago

@paiv Can you check my PR? https://github.com/CocoaPods/cocoapods-downloader/pull/111

paiv commented 3 years ago

Works for me.

% bundle exec pod --verbose install
  Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Sample`: (``)

Fetching external sources
-> Pre-downloading: `YPImagePicker` from `https://github.com/Yummypets/YPImagePicker.git`, branch `bypass-compression`
  $ /opt/local/bin/git ls-remote https://github.com/Yummypets/YPImagePicker.git bypass-compression
  9fd06737d0ed9039ede045a85526d92477a8c562  refs/heads/bypass-compression
 > Git download
 > Git download
     $ /opt/local/bin/git clone https://github.com/Yummypets/YPImagePicker.git
     /var/folders/9v/8vsfgn095n58ypf76vmt6kjr0000gn/T/d20210409-18815-n4kcym --template= --single-branch --depth 1 --branch bypass-compression
     Cloning into '/var/folders/9v/8vsfgn095n58ypf76vmt6kjr0000gn/T/d20210409-18815-n4kcym'...
   $ /opt/local/bin/git -C /var/folders/9v/8vsfgn095n58ypf76vmt6kjr0000gn/T/d20210409-18815-n4kcym checkout --quiet
   9fd06737d0ed9039ede045a85526d92477a8c562