aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
}