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

Is it possible to avoid remove and clone submodule again every time we checking out? #2651

Open
ainopara opened this issue Nov 28, 2018 · 2 comments

Comments

@ainopara
Copy link

ainopara commented Nov 28, 2018

  • carthage install method: [ ] .pkg, [✓] homebrew, [ ] source
  • which carthage: /usr/local/bin/carthage
  • carthage version: 0.31.2
  • xcodebuild -version: Xcode 10.1 Build version 10B61
  • Are you using --no-build? no
  • Are you using --no-use-binaries? yes
  • Are you using --use-submodules? no
  • Are you using --cache-builds? yes
  • Are you using --new-resolver? no

Cartfile

github "SnapKit/SnapKit" ~> 4.0
github "ReactiveX/RxSwift" ~> 4.0
github "RxSwiftCommunity/RxGesture" ~> 1.1.1
github "RxSwiftCommunity/RxDataSources" ~> 3.0

Carthage Output

N/A

** Command **

carthage bootstrap --platform iOS --no-use-binaries --cache-builds

Actual outcome

*** Checking out RxGesture at "1.2.1"
*** Checking out RxSwift at "4.4.0"
*** Checking out RxDataSources at "3.1.0"
*** Checking out SnapKit at "4.2.0"
<- Waiting here to clone RxSwift twice.
...... (Omitting other output not related to this issue)

Expected outcome
Carthage should complete check out phase immediately since nothing changed (Cartfile.resolved not changed) here. But in this example, both RxGesture and RxDataSources have a RxSwift submodule.
In CarthageKit/Git.swift we have:

return SignalProducer<(), CarthageError> { () -> Result<(), CarthageError> in
repositoryCheck("remove submodule checkout") {
try FileManager.default.removeItem(at: submoduleDirectoryURL)
}
}
.then(cloneRepository(submodule.url, workingDirectoryURL.appendingPathComponent(submodule.path), isBare: false))
.then(checkoutSubmodule(submodule, submoduleDirectoryURL))
.then(purgeGitDirectories)

This method remove submodule directory entirely and clone it again which seems not necessary.
This behavior is introduced in fe918b1 as a fix of #76
Can we optimize the solution by trying checkout submodule first and only when we failed to checkout the specific commit, we clone it again?

@mdiep
Copy link
Member

mdiep commented Nov 28, 2018

PRs welcome. :)

@stale
Copy link

stale bot commented Dec 28, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 28, 2018
@stale stale bot removed the stale label Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants