From dff44917e7aebdf7719930400a13ecff6f93fc8f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 27 Oct 2021 01:03:19 +0200 Subject: [PATCH] Gitea use default branch (#480) (#482) instead of hard-coded default branch use what gitea tell us Co-authored-by: Anbraten --- remote/gitea/helper.go | 2 +- remote/gitea/helper_test.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/remote/gitea/helper.go b/remote/gitea/helper.go index 3932c66fc..2731cb18f 100644 --- a/remote/gitea/helper.go +++ b/remote/gitea/helper.go @@ -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, } } diff --git a/remote/gitea/helper_test.go b/remote/gitea/helper_test.go index 1b9300fe1..356d5236d 100644 --- a/remote/gitea/helper_test.go +++ b/remote/gitea/helper_test.go @@ -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)