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.
This commit is contained in:
想出网名啦 2022-09-08 00:34:08 +08:00 committed by GitHub
parent 876cbce0f5
commit eaf05dbae8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,7 +82,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 {