diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-12-10 18:23:34 -0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-12-11 10:23:34 +0800 |
commit | 58a7de2aeae7ca08fc886d3586ee077094a9bc6c (patch) | |
tree | 4955f3d669bc4f6d60a79b1e5e0e70425d7eff3e /vendor/code.gitea.io/git/signature.go | |
parent | 682ac11958fed286bb0ca4d488084953f50779ef (diff) | |
download | gitea-58a7de2aeae7ca08fc886d3586ee077094a9bc6c.tar.gz gitea-58a7de2aeae7ca08fc886d3586ee077094a9bc6c.zip |
Update code.gitea.io/git (#3137)
Diffstat (limited to 'vendor/code.gitea.io/git/signature.go')
-rw-r--r-- | vendor/code.gitea.io/git/signature.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vendor/code.gitea.io/git/signature.go b/vendor/code.gitea.io/git/signature.go index 7dc9763b5d..e6ab247fd7 100644 --- a/vendor/code.gitea.io/git/signature.go +++ b/vendor/code.gitea.io/git/signature.go @@ -17,6 +17,11 @@ type Signature struct { When time.Time } +const ( + // GitTimeLayout is the (default) time layout used by git. + GitTimeLayout = "Mon Jan _2 15:04:05 2006 -0700" +) + // Helper to get a signature from the commit line, which looks like these: // author Patrick Gundlach <gundlach@speedata.de> 1378823654 +0200 // author Patrick Gundlach <gundlach@speedata.de> Thu, 07 Apr 2005 22:13:13 +0200 @@ -40,7 +45,7 @@ func newSignatureFromCommitline(line []byte) (_ *Signature, err error) { seconds, _ := strconv.ParseInt(timestring, 10, 64) sig.When = time.Unix(seconds, 0) } else { - sig.When, err = time.Parse("Mon Jan _2 15:04:05 2006 -0700", string(line[emailEnd+2:])) + sig.When, err = time.Parse(GitTimeLayout, string(line[emailEnd+2:])) if err != nil { return nil, err } |