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

CocoaPods 1.16 breaks Pods that depends on .git folder #12674

Open
1 task done
andreabusi opened this issue Oct 30, 2024 · 8 comments
Open
1 task done

CocoaPods 1.16 breaks Pods that depends on .git folder #12674

andreabusi opened this issue Oct 30, 2024 · 8 comments

Comments

@andreabusi
Copy link

Report

What did you do?

We have a custom pod that use the prepare_command option to execute a script. That script performs some operations in order to install some dependencies and update a git submodule contained in the repo.

This pod works properly until CocoaPods v1.15.2, but it's broken with v1.16 (and 1.16.1).

To replicate the issue, we recreate a sample that mimic our configuration:

In the sample project, we created this Podfile:

platform :ios, '13.0'
use_frameworks!

target 'GitPodSample' do
  pod 'GitPods', :git => 'https://github.com/comelit/cocoapods-gitissue.git', :branch => 'main'
end

Executing pod install using CocoaPods v1.16 doesn't work.

We already investigate and the issue seems related to this change, that didn't copy the .git folder in the cache directory: bc5fdc6

What did you expect to happen?

We expect that the pod is properly installed (as in CocoaPods v1.15.x)

What happened instead?

pod install fails with an error:

> pod install
Analyzing dependencies
Pre-downloading: `GitPods` from `https://github.com/comelit/cocoapods-gitissue.git`, commit `aad676950b3d5dc0116442e4b1276f0a6bedec66`
[!] Failed to download 'GitPods': [!] /bin/bash -c
set -e
./installer.sh pod-init


  ____ _ _   ____           _
 / ___(_) |_|  _ \ ___   __| |___
| |  _| | __| |_) / _ \ / _` / __|
| |_| | | |_|  __/ (_) | (_| \__ \
 \____|_|\__|_|   \___/ \__,_|___/


/Users/andrea/Library/Caches/CocoaPods/Pods/External/GitPods/862e56d2989b3938f0a33816d00dfecd/

fatal: not a git repository (or any of the parent directories): .git

CocoaPods Environment

Stack

   CocoaPods : 1.16.1
        Ruby : ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
    RubyGems : 3.4.10
        Host : macOS 14.7 (23H124)
       Xcode : 16.1 (16B40)
         Git : git version 2.39.5 (Apple Git-154)
Ruby lib dir : /Users/andrea/.rbenv/versions/3.2.2/lib
Repositories : bitbucket-comelit-comelit-pods - git - https://bitbucket.org/comelit/comelit-pods.git @ 8ef03af318478502a4c7d678eb8f25cb3a3cca6b

               bubidevs-bubidevs-pods - git - git@github.com:BubiDevs/bubidevs-pods.git @ 072d3e8c26431b60baf996d5a399178d6a70e8ff

               cocoapods - git - https://github.com/CocoaPods/Specs.git @ fcf23bd107256407e97c2abfc2401949dab1d5fa

               comelit-pods - git - https://andreabusi@bitbucket.org/comelit/comelit-pods.git @ 8ef03af318478502a4c7d678eb8f25cb3a3cca6b

               trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /Users/andrea/.rbenv/versions/3.2.2/bin/pod

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

platform :ios, '13.0'
use_frameworks!

target 'GitPodSample' do
  pod 'GitPods', :git => 'https://github.com/comelit/cocoapods-gitissue.git', :branch => 'main'
end

Project that demonstrates the issue

@andreabusi andreabusi changed the title CocoaPods 1.16 break Pods that depends on .git folder CocoaPods 1.16 breaks Pods that depends on .git folder Oct 30, 2024
@svenmuennich
Copy link

We have the same setup (prepare_command that interacts with a git submodule) and have the same issue since v1.16.0.

@filipealva
Copy link

could be that this pod just doesn't work with xcodeproj 1.26.0?

I had similar issues and ensuring to work with a cocoapods version that works with a xcodeproj up to 1.25.0 fixed it

might be a different issue, though

@andreabusi
Copy link
Author

could be that this pod just doesn't work with xcodeproj 1.26.0?

I had similar issues and ensuring to work with a cocoapods version that works with a xcodeproj up to 1.25.0 fixed it

might be a different issue, though

I've just tried to fix the xcodeproj version, but the issue still occours.

I think that the issue has been introduced by the usage of rsync instead of FileUtils package. Inspecting this commit, the .git folder is excluded from the rsync, that cause the issue.

@jkuchar
Copy link

jkuchar commented Nov 1, 2024

The folder is removed after git download. I have checked, while it was processing the first step and it was there. After moving the result into cache, .git folder was not present anymore.

@andreabusi
Copy link
Author

I created a test version of the CocoaPods gem removing the --exclude=.git option and it seems to work properly. Here is my branch: https://github.com/andreabusi/CocoaPods/tree/fix/fix_rsync_git_folder

I don't know if it's the right approach. @amorde could you please help us to identify if the option --exclude=.git in your commit is done by a purpouse or we can remove it?

@amorde
Copy link
Member

amorde commented Nov 10, 2024

that was added by @justinseanmartin to fix a performance issue, and I believe removing it would effectively break that optimization. I'm not familiar enough with the issue to know for sure though.

@andreabusi
Copy link
Author

that was added by @justinseanmartin to fix a performance issue, and I believe removing it would effectively break that optimization. I'm not familiar enough with the issue to know for sure though.

Thanks for the reply. I understand that the fix has been added for a reason, but the side effects are quite huge, because a lot of pods depends from the .git folder. How can we manage it?

@andreabusi
Copy link
Author

andreabusi commented Nov 19, 2024

Any update on this? The issue is becoming very critical for us

/cc @justinseanmartin @amorde

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants