Skip to content

Commit

Permalink
Ensure default gpg settings not nil and found commits have reference …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
zeripath authored Oct 20, 2019
1 parent c8f3146 commit 28f60bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions models/gpg_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ func ParseCommitWithSignature(c *git.Commit) *CommitVerification {
defaultGPGSettings, err := c.GetRepositoryDefaultPublicGPGKey(false)
if err != nil {
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 {
if commitVerification := verifyWithGPGSettings(defaultGPGSettings, sig, c.Signature.Payload, committer, keyID); commitVerification != nil {
if commitVerification.Reason == BadSignature {
Expand Down
1 change: 1 addition & 0 deletions modules/git/commit_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string, cache LastCom
treeCommit = commit
} else if rev, ok := revs[""]; ok {
treeCommit = convertCommit(rev)
treeCommit.repo = commit.repo
}
return commitsInfo, treeCommit, nil
}
Expand Down

0 comments on commit 28f60bb

Please sign in to comment.