aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/object.go
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2017-03-30 19:28:15 +0100
committerNick Thomas <nick@gitlab.com>2017-03-30 19:28:15 +0100
commitbdb72deddcc0b1c1f4eb71acb26da01c2e15fb79 (patch)
tree45e8f78f46d9ba0dea18bf14331a5c74b79b97cb /plumbing/object/object.go
parente512b0280d2747249acecdd8ba33b2ec80d0f364 (diff)
downloadgo-git-bdb72deddcc0b1c1f4eb71acb26da01c2e15fb79.tar.gz
Work around a Go bug when parsing timezones
Diffstat (limited to 'plumbing/object/object.go')
-rw-r--r--plumbing/object/object.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/plumbing/object/object.go b/plumbing/object/object.go
index 701145d..4b59aba 100644
--- a/plumbing/object/object.go
+++ b/plumbing/object/object.go
@@ -138,7 +138,12 @@ func (s *Signature) decodeTimeAndTimeZone(b []byte) {
return
}
- tl, err := time.Parse("-0700", string(b[tzStart:tzStart+timeZoneLength]))
+ // Include a dummy year in this time.Parse() call to avoid a bug in Go:
+ // https://github.com/golang/go/issues/19750
+ //
+ // Parsing the timezone with no other details causes the tl.Location() call
+ // below to return time.Local instead of the parsed zone in some cases
+ tl, err := time.Parse("2006 -0700", "1970 "+string(b[tzStart:tzStart+timeZoneLength]))
if err != nil {
return
}