Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cli/dispatcher/internal/dispatcher/dispatcher_v2_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ func isDispatcherGitPackageDependency(dependency json.RawMessage) bool {
return false
}
withoutRevision, _, _ := strings.Cut(strings.TrimSpace(value), "#")
if strings.HasPrefix(withoutRevision, "git@") {
return strings.HasSuffix(withoutRevision, ".git")
withoutQuery, _, _ := strings.Cut(withoutRevision, "?")
if strings.HasPrefix(withoutQuery, "git@") {
return strings.HasSuffix(withoutQuery, ".git")
}
parsed, err := url.Parse(withoutRevision)
parsed, err := url.Parse(withoutQuery)
if err != nil {
return false
}
Expand Down
22 changes: 22 additions & 0 deletions cli/dispatcher/internal/dispatcher/dispatcher_v2_detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,28 @@ func TestDetectV2DispatcherProjectRejectsNonGitManifestFallbackWithoutLockEntry(
}
}

func TestIsDispatcherGitPackageDependencyAcceptsPathQueries(t *testing.T) {
// Verifies Unity Git dependencies with path queries remain eligible for PackageCache fallback.
testCases := []struct {
name string
dependency string
}{
{name: "scp", dependency: "git@example.invalid:package.git?path=/sub"},
{name: "https", dependency: "https://example.invalid/package.git?path=/sub"},
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
dependency, err := json.Marshal(testCase.dependency)
if err != nil {
t.Fatalf("marshal dependency: %v", err)
}
if !isDispatcherGitPackageDependency(dependency) {
t.Fatalf("Git dependency was rejected: %s", testCase.dependency)
}
})
}
}

func TestRunDispatcherReportsV2ProjectGuidanceWhenPinIsMissing(t *testing.T) {
// Verifies pinless V2 projects receive migration guidance instead of the missing-pin error.
projectRoot := createDispatcherUnityProject(t)
Expand Down
Loading