You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve the diagnostics that are emitted when a package dependency specifies a non-existent branch or commit
This also sets the code up to make it easier to do other similar heuristics as needed, and as a bonus, adds one that is related to the `master` -> `main` renaming (suggesting `main` if `master` is requested and doesn't exist, but `main` does). There isn't yet any support for fix-its in SwiftPM, but this would be a case for such a facility once it is supported.
Note that tags go through different processing, since they are the inputs to the semantic versioning and missing tags are reported differently. There is no way in SwiftPM to define an explicit dependency on a non-semver tag, which is why this code only needs to handle branches and commits.
The error message does not list all the branches, since there can be many, but that could be another future improvement (or at least to list all the branches whose names are similar to what was requested).
rdar://34099187
// Examine the error to see if we can come up with a more informative and actionable error message. We know that the revision is expected to be a branch name or a hash (tags are handled through a different code path).
399
+
iflet gitInvocationError = error as?ProcessResult.Error, gitInvocationError.description.contains("Needed a single revision"){
400
+
// It was a Git process invocation error. Take a look at the repository to see if we can come up with a reasonable diagnostic.
XCTAssertMatch(error.description,.and(.prefix("package at '/' @"),.suffix("is using Swift tools version 3.1.0 which is no longer supported; consider using '// swift-tools-version:4.0' to specify the current tools version")))
280
281
}
@@ -495,4 +496,62 @@ class RepositoryPackageContainerProviderTests: XCTestCase {
0 commit comments