mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-19 00:10:15 +00:00
sourcehut: use ssh sources URL when appropriate
Co-authored-by: Jordan Anderson <jordan@jba.io>
This commit is contained in:
parent
6e13ac4d5f
commit
3bea06f906
2 changed files with 59 additions and 3 deletions
|
@ -289,16 +289,21 @@ func adjustManifest(repo *api.Repository, commitID, gitRef string, r io.Reader,
|
|||
manifest.Environment["BUILD_SUBMITTER_URL"] = setting.AppURL
|
||||
manifest.Environment["GIT_REF"] = gitRef
|
||||
|
||||
source := repo.CloneURL + "#" + commitID
|
||||
found := false
|
||||
for i, s := range manifest.Sources {
|
||||
if s == repo.CloneURL {
|
||||
manifest.Sources[i] = source
|
||||
if s == repo.CloneURL || s == repo.SSHURL {
|
||||
manifest.Sources[i] = s + "#" + commitID
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
source := repo.CloneURL
|
||||
if repo.Private || setting.Repository.DisableHTTPGit {
|
||||
// default to ssh for private repos or when git clone is disabled over http
|
||||
source = repo.SSHURL
|
||||
}
|
||||
source += "#" + commitID
|
||||
manifest.Sources = append(manifest.Sources, source)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue