aboutsummaryrefslogtreecommitdiffhomepage
path: root/releaser
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-01-11 09:39:42 +0100
committerBjørn Erik Pedersen <[email protected]>2018-01-11 09:39:42 +0100
commitf82428d2e0c5078c11d1b296f7ebc8cfb6216860 (patch)
tree26b386ea82e2f6bc5e535b56ca8d47f1a8e504f9 /releaser
parent50fb49c3d979b1e590d1e4f49258506f447e3318 (diff)
downloadhugo-f82428d2e0c5078c11d1b296f7ebc8cfb6216860.tar.gz
hugo-f82428d2e0c5078c11d1b296f7ebc8cfb6216860.zip
releaser: Git info bounds checking
Diffstat (limited to 'releaser')
-rw-r--r--releaser/git.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/releaser/git.go b/releaser/git.go
index 8d8bbd68d..9999636fe 100644
--- a/releaser/git.go
+++ b/releaser/git.go
@@ -227,13 +227,22 @@ func getGitInfosBefore(ref, tag, repo, repoPath string, remote bool) (gitInfos,
for _, entry := range entries {
items := strings.Split(entry, "\x1f")
- gi := gitInfo{
- Hash: items[0],
- Author: items[1],
- Subject: items[2],
- Body: items[3],
+ gi := gitInfo{}
+
+ if len(items) > 0 {
+ gi.Hash = items[0]
+ }
+ if len(items) > 1 {
+ gi.Author = items[1]
+ }
+ if len(items) > 2 {
+ gi.Subject = items[2]
}
- if remote {
+ if len(items) > 3 {
+ gi.Body = items[3]
+ }
+
+ if remote && gi.Hash != "" {
gc, err := client.fetchCommit(gi.Hash)
if err == nil {
gi.GitHubCommit = &gc