From fc194ca146ee548dae7ea6a9bf3ce4b988ff19c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E5=87=BA=E7=BD=91=E5=90=8D=E5=95=A6?= Date: Thu, 8 Sep 2022 00:34:08 +0800 Subject: [PATCH] On Repo update, keep old "Clone" if update would empty it (#1170) fixed #1169 after debugging, I found that: if `Clone` in database is empty, before https://github.com/woodpecker-ci/woodpecker/blob/master/server/api/hook.go#L128, the `repo.Clone` be always unset, so clone is failed. This PR makes the empty `Clone` can't overwrite the value in database. --- server/model/repo.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/model/repo.go b/server/model/repo.go index 0d15ccb9bd4..9af873eb401 100644 --- a/server/model/repo.go +++ b/server/model/repo.go @@ -76,7 +76,9 @@ func (r *Repo) Update(from *Repo) { r.Avatar = from.Avatar r.Link = from.Link r.SCMKind = from.SCMKind - r.Clone = from.Clone + if len(from.Clone) > 0 { + r.Clone = from.Clone + } r.Branch = from.Branch if from.IsSCMPrivate != r.IsSCMPrivate { if from.IsSCMPrivate {