@@ -22,7 +22,7 @@ import (
2222var (
2323 pushCmdBranch , pushCmdCommit , pushCmdDB string
2424 pushCmdEmail , pushCmdLicence , pushCmdMsg string
25- pushCmdName string
25+ pushCmdName , pushCmdTimestamp string
2626 pushCmdForce , pushCmdPublic bool
2727)
2828
@@ -50,6 +50,7 @@ func init() {
5050 pushCmd .Flags ().StringVar (& pushCmdMsg , "message" , "" ,
5151 "(Required) Commit message for this upload" )
5252 pushCmd .Flags ().BoolVar (& pushCmdPublic , "public" , false , "Should the database be public?" )
53+ pushCmd .Flags ().StringVar (& pushCmdTimestamp , "timestamp" , "" , "Timestamp to use as the commit date" )
5354}
5455
5556func push (args []string ) error {
@@ -71,14 +72,16 @@ func push(args []string) error {
7172 }
7273
7374 // Grab author name & email from the dio config file, but allow command line flags to override them
74- var pushAuthor , pushEmail string
75+ var committerName , committerEmail , pushAuthor , pushEmail string
7576 u , ok := viper .Get ("user.name" ).(string )
7677 if ok {
7778 pushAuthor = u
79+ committerName = u
7880 }
7981 v , ok := viper .Get ("user.email" ).(string )
8082 if ok {
8183 pushEmail = v
84+ committerEmail = u
8285 }
8386 if pushCmdName != "" {
8487 pushAuthor = pushCmdName
@@ -372,6 +375,17 @@ func push(args []string) error {
372375 // database remotely (if it's not there already) and creates the local metadata.
373376 // If the database already exists remotely, this code will fail.
374377 // TODO: Maybe add a nicer failure message here for when local metadata is missing but the db exists remotely?
378+ z , ok := viper .Get ("user.name" ).(string )
379+ if ! ok {
380+ return fmt .Errorf ("Committer name could not be determined" )
381+ }
382+ committerName = z
383+ z , ok = viper .Get ("user.email" ).(string )
384+ if ! ok {
385+ return fmt .Errorf ("Committer email could not be determined" )
386+ }
387+ committerEmail = z
388+
375389 b , err := ioutil .ReadFile (db )
376390 if err != nil {
377391 return err
@@ -385,6 +399,9 @@ func push(args []string) error {
385399 Query (fmt .Sprintf ("branch=%s" , url .QueryEscape (pushCmdBranch ))).
386400 Query (fmt .Sprintf ("commit=%s" , pushCmdCommit )).
387401 Query (fmt .Sprintf ("commitmsg=%s" , url .QueryEscape (pushCmdMsg ))).
402+ Query (fmt .Sprintf ("committeremail=%s" , url .QueryEscape (committerEmail ))).
403+ Query (fmt .Sprintf ("committername=%s" , url .QueryEscape (committerName ))).
404+ Query (fmt .Sprintf ("committimestamp=%v" , pushCmdTimestamp )).
388405 Query (fmt .Sprintf ("dbshasum=%s" , url .QueryEscape (shaSum ))).
389406 Query (fmt .Sprintf ("force=%v" , pushCmdForce )).
390407 Query (fmt .Sprintf ("lastmodified=%s" , url .QueryEscape (fi .ModTime ().UTC ().Format (time .RFC3339 )))).
@@ -492,7 +509,7 @@ func sendCommit(meta metaData, db string, dbURL string, newCommit string, public
492509 Query (fmt .Sprintf ("authorname=%s" , url .QueryEscape (commitData .AuthorName ))).
493510 Query (fmt .Sprintf ("committeremail=%s" , url .QueryEscape (commitData .CommitterEmail ))).
494511 Query (fmt .Sprintf ("committername=%s" , url .QueryEscape (commitData .CommitterName ))).
495- Query (fmt .Sprintf ("commitlastmodified =%s" ,
512+ Query (fmt .Sprintf ("committimestamp =%s" ,
496513 url .QueryEscape (commitData .Timestamp .UTC ().Format (time .RFC3339 )))).
497514 Query (fmt .Sprintf ("otherparents=%s" , url .QueryEscape (otherParents ))).
498515 Query (fmt .Sprintf ("dbshasum=%s" , url .QueryEscape (shaSum ))).
0 commit comments