Browse Source

Skip "parentsigned" check when the repo is empty (#35292)

Fix #35280
pull/35300/head
wxiaoguang 4 months ago committed by GitHub
parent
commit
621f2fcadb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 20
      services/asymkey/sign.go

20
services/asymkey/sign.go

@ -290,16 +290,22 @@ Loop:
return false, nil, nil, err return false, nil, nil, err
} }
defer gitRepo.Close() defer gitRepo.Close()
commit, err := gitRepo.GetCommit(parentCommit) isEmpty, err := gitRepo.IsEmpty()
if err != nil { if err != nil {
return false, nil, nil, err return false, nil, nil, err
} }
if commit.Signature == nil { if !isEmpty {
return false, nil, nil, &ErrWontSign{parentSigned} commit, err := gitRepo.GetCommit(parentCommit)
} if err != nil {
verification := ParseCommitWithSignature(ctx, commit) return false, nil, nil, err
if !verification.Verified { }
return false, nil, nil, &ErrWontSign{parentSigned} if commit.Signature == nil {
return false, nil, nil, &ErrWontSign{parentSigned}
}
verification := ParseCommitWithSignature(ctx, commit)
if !verification.Verified {
return false, nil, nil, &ErrWontSign{parentSigned}
}
} }
} }
} }

Loading…
Cancel
Save