mirror of
https://github.com/dolthub/dolt.git
synced 2026-03-07 00:58:26 -06:00
Suport for DOLT_AUTHOR_DATE in dolt commit
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,5 +227,5 @@ SQL
|
||||
}
|
||||
|
||||
dolt_log_in_PST() {
|
||||
TZ=PST-7 dolt log -n1
|
||||
TZ=PST+8 dolt log -n1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user