Clone repository with Tea CLI (#33725)

This PR adds "Tea CLI" as a clone method.

<img width="350" alt="Capture d’écran 2025-02-25 à 23 38 47"
src="https://github.com/user-attachments/assets/8e86e54a-998b-45d1-9f20-167b449e79b6"
/>

---------

Signed-off-by: Quentin Guidée <quentin.guidee@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Quentin 2025-02-27 19:18:02 +01:00 committed by GitHub
parent b7aac5ef9a
commit f52e31f5ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 69 additions and 17 deletions

View file

@ -130,8 +130,13 @@ func TestViewRepo1CloneLinkAnonymous(t *testing.T) {
link, exists := htmlDoc.doc.Find(".repo-clone-https").Attr("data-link")
assert.True(t, exists, "The template has changed")
assert.Equal(t, setting.AppURL+"user2/repo1.git", link)
_, exists = htmlDoc.doc.Find(".repo-clone-ssh").Attr("data-link")
assert.False(t, exists)
link, exists = htmlDoc.doc.Find(".repo-clone-tea").Attr("data-link")
assert.True(t, exists, "The template has changed")
assert.Equal(t, "tea clone user2/repo1", link)
}
func TestViewRepo1CloneLinkAuthorized(t *testing.T) {
@ -146,10 +151,15 @@ func TestViewRepo1CloneLinkAuthorized(t *testing.T) {
link, exists := htmlDoc.doc.Find(".repo-clone-https").Attr("data-link")
assert.True(t, exists, "The template has changed")
assert.Equal(t, setting.AppURL+"user2/repo1.git", link)
link, exists = htmlDoc.doc.Find(".repo-clone-ssh").Attr("data-link")
assert.True(t, exists, "The template has changed")
sshURL := fmt.Sprintf("ssh://%s@%s:%d/user2/repo1.git", setting.SSH.User, setting.SSH.Domain, setting.SSH.Port)
assert.Equal(t, sshURL, link)
link, exists = htmlDoc.doc.Find(".repo-clone-tea").Attr("data-link")
assert.True(t, exists, "The template has changed")
assert.Equal(t, "tea clone user2/repo1", link)
}
func TestViewRepoWithSymlinks(t *testing.T) {