mirror of
https://github.com/go-gitea/gitea
synced 2024-12-21 15:57:53 +01:00
Ensure default gpg settings not nil and found commits have reference to repo (#8604)
* Ensure defaultGPGSettings not nil * Ensure that coerced commits gain a reference to the repo * Add warning if trying to get defaultgpgsetting on an unattached commit
This commit is contained in:
parent
c8f3146cd5
commit
28f60bb5cb
@ -682,6 +682,8 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
|
|||||||
defaultGPGSettings, err := c.GetRepositoryDefaultPublicGPGKey(false)
|
defaultGPGSettings, err := c.GetRepositoryDefaultPublicGPGKey(false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error getting default public gpg key: %v", err)
|
log.Error("Error getting default public gpg key: %v", err)
|
||||||
|
} else if defaultGPGSettings == nil {
|
||||||
|
log.Warn("Unable to get defaultGPGSettings for unattached commit: %s", c.ID.String())
|
||||||
} else if defaultGPGSettings.Sign {
|
} else if defaultGPGSettings.Sign {
|
||||||
if commitVerification := verifyWithGPGSettings(defaultGPGSettings, sig, c.Signature.Payload, committer, keyID); commitVerification != nil {
|
if commitVerification := verifyWithGPGSettings(defaultGPGSettings, sig, c.Signature.Payload, committer, keyID); commitVerification != nil {
|
||||||
if commitVerification.Reason == BadSignature {
|
if commitVerification.Reason == BadSignature {
|
||||||
|
@ -72,6 +72,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string, cache LastCom
|
|||||||
treeCommit = commit
|
treeCommit = commit
|
||||||
} else if rev, ok := revs[""]; ok {
|
} else if rev, ok := revs[""]; ok {
|
||||||
treeCommit = convertCommit(rev)
|
treeCommit = convertCommit(rev)
|
||||||
|
treeCommit.repo = commit.repo
|
||||||
}
|
}
|
||||||
return commitsInfo, treeCommit, nil
|
return commitsInfo, treeCommit, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user