Refactor parseSignatureFromCommitLine (#29054) (#29108)

Backport #29054. Fix #28840

This backport is for 1.21 only and it is different from the change in
1.22: this backport still accept the legacy date format to avoid
breaking.
This commit is contained in:
wxiaoguang 2024-02-09 17:26:43 +08:00 committed by GitHub
parent 1aaeec6da7
commit 732d511e04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 104 additions and 149 deletions

View file

@ -236,7 +236,7 @@ func GetLatestCommitTime(ctx context.Context, repoPath string) (time.Time, error
return time.Time{}, err
}
commitTime := strings.TrimSpace(stdout)
return time.Parse(GitTimeLayout, commitTime)
return time.Parse("Mon Jan _2 15:04:05 2006 -0700", commitTime)
}
// DivergeObject represents commit count diverging commits