Skip to content

Commit 28f60bb

Browse files
authored
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
1 parent c8f3146 commit 28f60bb

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

models/gpg_key.go

+2
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,8 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
682682
defaultGPGSettings, err := c.GetRepositoryDefaultPublicGPGKey(false)
683683
if err != nil {
684684
log.Error("Error getting default public gpg key: %v", err)
685+
} else if defaultGPGSettings == nil {
686+
log.Warn("Unable to get defaultGPGSettings for unattached commit: %s", c.ID.String())
685687
} else if defaultGPGSettings.Sign {
686688
if commitVerification := verifyWithGPGSettings(defaultGPGSettings, sig, c.Signature.Payload, committer, keyID); commitVerification != nil {
687689
if commitVerification.Reason == BadSignature {

modules/git/commit_info.go

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string, cache LastCom
7272
treeCommit = commit
7373
} else if rev, ok := revs[""]; ok {
7474
treeCommit = convertCommit(rev)
75+
treeCommit.repo = commit.repo
7576
}
7677
return commitsInfo, treeCommit, nil
7778
}

0 commit comments

Comments
 (0)