summaryrefslogtreecommitdiffstats
path: root/modules/git/commit_reader.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-05-12 06:11:42 +0100
committerGitHub <noreply@github.com>2021-05-12 01:11:42 -0400
commit2a565478d17f4a1b59a77b0e2251dd7b7de862c4 (patch)
treee300874a9199a9579767e0477d55a53c21d56d45 /modules/git/commit_reader.go
parent3d7d750a999b72d422000154a0b1f2801614521e (diff)
downloadgitea-2a565478d17f4a1b59a77b0e2251dd7b7de862c4.tar.gz
gitea-2a565478d17f4a1b59a77b0e2251dd7b7de862c4.zip
Tagger can be empty, as can Commit and Author - tolerate this (#15835)
Unfortunately some old repositories can have tags with empty Tagger, Commit or Author. Go-Git variants will always have empty values for these whereas the native git variant leaves them at nil. The simplest solution is just to always have these set to empty Signatures. v156 migration also makes the incorrect assumption that these cannot be empty. Therefore add some handling to this and add logging and adjust broken logging elsewhere in this migration. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/git/commit_reader.go')
-rw-r--r--modules/git/commit_reader.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/git/commit_reader.go b/modules/git/commit_reader.go
index a4d15b6bad..3c1f6f5ffd 100644
--- a/modules/git/commit_reader.go
+++ b/modules/git/commit_reader.go
@@ -17,7 +17,9 @@ import (
// If used as part of a cat-file --batch stream you need to limit the reader to the correct size
func CommitFromReader(gitRepo *Repository, sha SHA1, reader io.Reader) (*Commit, error) {
commit := &Commit{
- ID: sha,
+ ID: sha,
+ Author: &Signature{},
+ Committer: &Signature{},
}
payloadSB := new(strings.Builder)