diff --git a/go/libraries/doltcore/sqle/dprocedures/dolt_commit.go b/go/libraries/doltcore/sqle/dprocedures/dolt_commit.go index 676400ecc3..08b97e3d64 100644 --- a/go/libraries/doltcore/sqle/dprocedures/dolt_commit.go +++ b/go/libraries/doltcore/sqle/dprocedures/dolt_commit.go @@ -23,6 +23,7 @@ import ( "github.com/dolthub/dolt/go/libraries/doltcore/dconfig" "github.com/dolthub/dolt/go/libraries/doltcore/env/actions" "github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess" + "github.com/dolthub/dolt/go/store/datas" "github.com/dolthub/go-mysql-server/sql" "github.com/dolthub/go-mysql-server/sql/types" ) @@ -131,6 +132,8 @@ func doDoltCommit(ctx *sql.Context, args []string) (string, bool, error) { if err != nil { return "", false, fmt.Errorf(err.Error()) } + } else if datas.CustomAuthorDate { + t = datas.AuthorDate() } if apr.Contains(cli.ForceFlag) { diff --git a/go/store/datas/commit_meta.go b/go/store/datas/commit_meta.go index dd513f6020..2372dc2bb2 100644 --- a/go/store/datas/commit_meta.go +++ b/go/store/datas/commit_meta.go @@ -49,6 +49,7 @@ var CommitterDate = time.Now var CommitLoc = time.Local var AuthorDate = time.Now +var CustomAuthorDate bool var AuthorLoc = time.Local // CommitMeta contains all the metadata that is associated with a commit within a data repo. @@ -73,9 +74,10 @@ func init() { if err != nil { logrus.Warnf("Unable to parse value for %s: %s. System time will be used instead.", dconfig.EnvDoltCommitterDate, err.Error()) - } - CommitterDate = func() time.Time { - return committerDate + } else { + CommitterDate = func() time.Time { + return committerDate + } } } @@ -85,9 +87,11 @@ func init() { if err != nil { logrus.Warnf("Unable to parse value for %s: %s. System time will be used instead.", dconfig.EnvDoltAuthorDate, err.Error()) - } - AuthorDate = func() time.Time { - return authorDate + } else { + AuthorDate = func() time.Time { + return authorDate + } + CustomAuthorDate = true } } } diff --git a/integration-tests/bats/commit.bats b/integration-tests/bats/commit.bats index 1b95e44580..8a21685000 100644 --- a/integration-tests/bats/commit.bats +++ b/integration-tests/bats/commit.bats @@ -227,5 +227,5 @@ SQL } dolt_log_in_PST() { - TZ=PST-7 dolt log -n1 + TZ=PST+8 dolt log -n1 }