@@ -29,7 +29,6 @@ import (
2929 "github.com/dolthub/dolt/go/libraries/doltcore/env/actions"
3030 "github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
3131 "github.com/dolthub/dolt/go/libraries/utils/gpg"
32- "github.com/dolthub/dolt/go/store/datas"
3332)
3433
3534// doltCommit is the stored procedure version for the CLI command `dolt commit`.
@@ -111,19 +110,6 @@ func doDoltCommit(ctx *sql.Context, args []string) (string, bool, error) {
111110 }
112111 }
113112
114- var name , email string
115- if authorStr , ok := apr .GetValue (cli .AuthorParam ); ok {
116- name , email , err = cli .ParseAuthor (authorStr )
117- if err != nil {
118- return "" , false , err
119- }
120- } else {
121- // In SQL mode, use the current SQL user as the commit author, instead of the `dolt config` configured values.
122- // We won't have an email address for the SQL user though, so instead use the MySQL user@address notation.
123- name = ctx .Client ().User
124- email = fmt .Sprintf ("%s@%s" , ctx .Client ().User , ctx .Client ().Address )
125- }
126-
127113 amend := apr .Contains (cli .AmendFlag )
128114
129115 msg , msgOk := apr .GetValue (cli .MessageArg )
@@ -143,23 +129,31 @@ func doDoltCommit(ctx *sql.Context, args []string) (string, bool, error) {
143129 }
144130 }
145131
146- t := ctx .QueryTime ()
147- commitStagedProps := actions .NewCommitStagedProps (name , email , t , msg )
132+ commitStagedProps , err := dSess .NewCommitStagedPropsFromSession (ctx , msg )
133+ if err != nil {
134+ return "" , false , err
135+ }
148136 commitStagedProps .AllowEmpty = apr .Contains (cli .AllowEmptyFlag )
149137 commitStagedProps .SkipEmpty = apr .Contains (cli .SkipEmptyFlag )
150138 commitStagedProps .Amend = amend
151139
140+ // Override author if --author flag is provided.
141+ if authorStr , ok := apr .GetValue (cli .AuthorParam ); ok {
142+ name , email , err := cli .ParseAuthor (authorStr )
143+ if err != nil {
144+ return "" , false , err
145+ }
146+ commitStagedProps .Name = name
147+ commitStagedProps .Email = email
148+ }
149+
150+ // Override author date if --date flag is provided.
152151 if commitTimeStr , ok := apr .GetValue (cli .DateParam ); ok {
153- var err error
154- t , err = dconfig .ParseDate (commitTimeStr )
155- commitStagedProps .Date = t
156- commitStagedProps .CommitterDate = & t
152+ t , err := dconfig .ParseDate (commitTimeStr )
157153 if err != nil {
158154 return "" , false , err
159155 }
160- } else if datas .CustomAuthorDate {
161- t = datas .AuthorDate ()
162- commitStagedProps .Date = t
156+ commitStagedProps .Date = & t
163157 }
164158
165159 if apr .Contains (cli .ForceFlag ) {
0 commit comments