Gitea use default branch (#480) (#482)

instead of hard-coded default branch use what gitea tell us

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
6543 2021-10-27 01:03:19 +02:00 committed by GitHub
parent 3af5f99fb2
commit dff44917e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -46,7 +46,7 @@ func toRepo(from *gitea.Repository, privateMode bool) *model.Repo {
Link: from.HTMLURL,
IsPrivate: private,
Clone: from.CloneURL,
Branch: "master",
Branch: from.DefaultBranch,
}
}

View file

@ -202,9 +202,10 @@ func Test_parse(t *testing.T) {
UserName: "gordon",
AvatarURL: "http://1.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87",
},
CloneURL: "http://gitea.golang.org/gophers/hello-world.git",
HTMLURL: "http://gitea.golang.org/gophers/hello-world",
Private: true,
CloneURL: "http://gitea.golang.org/gophers/hello-world.git",
HTMLURL: "http://gitea.golang.org/gophers/hello-world",
Private: true,
DefaultBranch: "master",
}
repo := toRepo(&from, false)
g.Assert(repo.FullName).Equal(from.FullName)