Repository navigation
Conversation
SwiftPM names a checkout's folder after the last element of the dependency's URL, such as GRDB.swift, and records the identity in Package.resolved in lower case, grdb.swift. Plonge looked up the pin by the folder name as written, so it refused the checkout of any dependency whose name has a capital letter. The reproduction in issue 33 fails on this check once the submodule check passes.
SwiftPM initializes a dependency's submodules when it makes a checkout, so a .build or DerivedData folder with a dependency such as GRDB.swift held a Git directory in .git/modules that Plonge refused, even right after swift package resolve (issue 33). Plonge now lets through a submodule of an accepted checkout, recursively, when its Git directory is the one that .gitmodules names in the parent's .git/modules, its HEAD is the commit that the parent records, it passes the checkout's checks for local changes, and its origin is the URL in .gitmodules. A submodule has no bare clone in the cache to compare tags with, so every commit must be in HEAD or in refs/remotes/origin. git status does not look inside the folder of a submodule that is not initialized, so a checkout with files there is now refused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plonge refused a SwiftPM
.buildor XcodeDerivedDatafolder whenever a dependency's checkout had a Git submodule, even right afterswift package resolve. SwiftPM initializes submodules when it makes a checkout, so the Git directory in the checkout's.git/modulesis part of a cache that SwiftPM can make again. GRDB.swift, with itsSQLiteCustom/srcsubmodule, is the example in the issue.Plonge now lets through a submodule of an accepted checkout, in
.build/checkoutsand inSourcePackages/checkouts, when all of these hold:.gitmodulesat the parent'sHEADgives the submodule's path one name and one URL, the submodule's.gitfile names.git/modules/<name>in the parent, and that Git directory has nocommondir, no linked worktrees, and acore.worktreethat names the submodule's folder.HEADis the commit that the parent'sHEADrecords for its path.origin.origin, andsubmodule.<name>.urlin the parent's configuration are the URL in.gitmodules, compared as a bare clone's origin is compared with a pin'slocation.HEADor inrefs/remotes/origin.These rules are stricter than the criteria in the issue in a few places. A submodule has no bare clone in the cache to compare its tags with, so a tag does not count, and a tag at a commit outside
HEADand the remote-tracking refs refuses the folder. A relative URL in.gitmodulesis refused. Plonge compares URLs as written and does not applyurl.<base>.insteadOf; Git stores the URL before it rewrites it, so a rewritten URL still matches. A Git directory thatgit submodule deinitleaves in.git/modulesis refused, and so is a.gitfile that is not part of a submodule that passes.One existing behavior changes.
git statusdoes not look inside the folder of a submodule that is not initialized, so Plonge accepted a checkout with files there. It now refuses that checkout, and accepts a submodule that is not initialized only when its folder is empty.The checks run offline, so they cannot tell whether a commit in a submodule's
refs/remotes/originrefs is still at its origin, or was put there without a push. Whengit statusin the checkout reports the submodule, for a changed or untracked file or another commit, the reason names the checkout and not the submodule.The reproduction in the issue also failed a second check. SwiftPM names the checkout's folder
GRDB.swiftand writes the identity inPackage.resolvedasgrdb.swift, and Plonge looked up the pin by the folder name as written. The first commit looks it up in lower case, which affects every dependency whose name has a capital letter.Closes #33