diff options
author | Lauris BH <lauris@nix.lv> | 2018-09-07 05:06:09 +0300 |
---|---|---|
committer | techknowlogick <techknowlogick@users.noreply.github.com> | 2018-09-06 22:06:09 -0400 |
commit | fa4663e61e39f0cef225ea92235a16e7da977b08 (patch) | |
tree | 7a4a784295c5b0efea8319352ca9987e4abe4148 /vendor/code.gitea.io/git/repo_commit.go | |
parent | bf552761894dee08f734d91f5c8175cd0cb2f9f5 (diff) | |
download | gitea-fa4663e61e39f0cef225ea92235a16e7da977b08.tar.gz gitea-fa4663e61e39f0cef225ea92235a16e7da977b08.zip |
Add push webhook support for mirrored repositories (#4127)
Diffstat (limited to 'vendor/code.gitea.io/git/repo_commit.go')
-rw-r--r-- | vendor/code.gitea.io/git/repo_commit.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/vendor/code.gitea.io/git/repo_commit.go b/vendor/code.gitea.io/git/repo_commit.go index 1acdfffb34..d5cab8f873 100644 --- a/vendor/code.gitea.io/git/repo_commit.go +++ b/vendor/code.gitea.io/git/repo_commit.go @@ -78,7 +78,7 @@ l: } commit.Committer = sig case "gpgsig": - sig, err := newGPGSignatureFromCommitline(data, nextline+spacepos+1) + sig, err := newGPGSignatureFromCommitline(data, nextline+spacepos+1, false) if err != nil { return nil, err } @@ -86,7 +86,20 @@ l: } nextline += eol + 1 case eol == 0: - commit.CommitMessage = string(data[nextline+1:]) + cm := string(data[nextline+1:]) + + // Tag GPG signatures are stored below the commit message + sigindex := strings.Index(cm, "-----BEGIN PGP SIGNATURE-----") + if sigindex != -1 { + sig, err := newGPGSignatureFromCommitline(data, (nextline+1)+sigindex, true) + if err == nil && sig != nil { + // remove signature from commit message + cm = cm[:sigindex-1] + commit.Signature = sig + } + } + + commit.CommitMessage = cm break l default: break l |