Skip to content

Commit dbe7f38

Browse files
committed
.trac branches were different when generated in different timezones.
Something was magically applying the local timezone even though we tried to copy the timestamp object directly from the child commit. Force it to UTC instead to avoid the problem.
1 parent 81d0162 commit dbe7f38

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

subtrac.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"sort"
1313
"strconv"
1414
"strings"
15+
"time"
1516
)
1617

1718
// A Trac represents a commit or tree somewhere in the project's hierarchy,
@@ -316,7 +317,12 @@ func (c *Cache) newTracCommit(commit *object.Commit, tracs []*object.Commit, hea
316317
sig := object.Signature{
317318
Name: "git-subtrac",
318319
Email: "git-subtrac@",
319-
When: commit.Committer.When,
320+
// This *should* preserve the timezone from the original
321+
// commit, but a bug in either go-git or go's time library
322+
// prevents that from working and uses the local timezone
323+
// instead. We want the generated commits to be identical
324+
// no matter who generates them, so let's force UTC instead.
325+
When: commit.Committer.When.In(time.UTC),
320326
}
321327
emptyTree := object.Tree{}
322328
nec := c.repo.Storer.NewEncodedObject()

0 commit comments

Comments
 (0)