【发布时间】:2020-07-06 16:08:33
【问题描述】:
我正在通过 go-git 提交更改:
import (
"github.com/tcnksm/go-gitconfig"
"github.com/walterjwhite/go-application/libraries/logging"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
)
func stackoverflowCommit(R *git.Repository, W *git.Worktree) {
username, err := gitconfig.Username()
logging.Panic(err)
email, err := gitconfig.Email()
logging.Panic(err)
_, err = W.Commit("commit message goes here", &git.CommitOptions{Author: &object.Signature{Name: username, Email: email}})
logging.Panic(err)
}
在我的日志中,我看到了这个:
Date: Thu Jan 1 00:00:00 1970 +0000
这是预期的行为吗?无论如何,我看不到我可以通过约会。对源代码的快速检查显示 Commit 对象没有任何对日期的引用...
是这样吗,还是我错过了什么?
【问题讨论】:
-
我没有答案,但 1970 年 1 月 1 日午夜是 Unix time 的零值,这是软件中广泛使用的时间度量。