mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
releaser: Git info bounds checking
This commit is contained in:
parent
50fb49c3d9
commit
f82428d2e0
1 changed files with 15 additions and 6 deletions
|
@ -227,13 +227,22 @@ func getGitInfosBefore(ref, tag, repo, repoPath string, remote bool) (gitInfos,
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
items := strings.Split(entry, "\x1f")
|
items := strings.Split(entry, "\x1f")
|
||||||
gi := gitInfo{
|
gi := gitInfo{}
|
||||||
Hash: items[0],
|
|
||||||
Author: items[1],
|
if len(items) > 0 {
|
||||||
Subject: items[2],
|
gi.Hash = items[0]
|
||||||
Body: items[3],
|
|
||||||
}
|
}
|
||||||
if remote {
|
if len(items) > 1 {
|
||||||
|
gi.Author = items[1]
|
||||||
|
}
|
||||||
|
if len(items) > 2 {
|
||||||
|
gi.Subject = items[2]
|
||||||
|
}
|
||||||
|
if len(items) > 3 {
|
||||||
|
gi.Body = items[3]
|
||||||
|
}
|
||||||
|
|
||||||
|
if remote && gi.Hash != "" {
|
||||||
gc, err := client.fetchCommit(gi.Hash)
|
gc, err := client.fetchCommit(gi.Hash)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
gi.GitHubCommit = &gc
|
gi.GitHubCommit = &gc
|
||||||
|
|
Loading…
Reference in a new issue