Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 8437933

Browse files
authored
Merge pull request #364 from sourcegraph/strip-git
Strip .git suffix from dependencies
2 parents 61b1deb + 5f93bf0 commit 8437933

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

buildserver/deps.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,15 @@ var NewDepRepoVFS = func(ctx context.Context, cloneURL *url.URL, rev string, zip
500500
if archive != nil && err == nil {
501501
return archive, nil
502502
}
503+
504+
// If the repository name ends with `.git` then try again without it.
505+
if strings.HasSuffix(cloneURL.Path, ".git") {
506+
zipURL := fmt.Sprintf(*zipURLTemplate, path.Join(cloneURL.Host, strings.TrimSuffix(cloneURL.Path, ".git")), rev)
507+
archive, err := vfsutil.NewZipVFS(ctx, zipURL, depZipFetch.Inc, depZipFetchFailed.Inc, false)
508+
if archive != nil && err == nil {
509+
return archive, nil
510+
}
511+
}
503512
}
504513

505514
// Fast-path for GitHub repos, which we can fetch on-demand from

0 commit comments

Comments
 (0)