DOLT_COMMIT allows setting a custom date and time using --date. However, the same is not possible for the merge commit that DOLT_MERGE generates, for example with --no-ff active.
The use case we have is that we would like to generate some 'fixtures' or fake commits with older timestamps to generate a semi-realistic commit log for testing purposes. This works well enough with dolt sql and the --date flag for commits, but seems to be impossible for merge commits, specifically.
So far I've found no good way to fake the time for these commits in Dolt:
- libfaketime and
LD_PRELOADing the library into the Dolt SQL server doesn't appear to work, nor does it work for the dolt sql command - the README of the library mentions golang applications being possibly problematic, though.
- Setting MySQL's TIMESTAMP using
SET TIMESTAMP = UNIX_TIMESTAMP('1980-01-01T12:34:56'); before doing a commit, but whilst Dolt SQL accepts the sets, subsequent calls to NOW() or doing commits still use the system time.
My last resort is a full-blown VM where I have control over the time or setting system time globally outside the container (it is blocked by default and requires elevated privileges), but since it is tied to the host time, doing so is not great because it's not particularly cross-platform and breaks outside of the containers.
DOLT_COMMITallows setting a custom date and time using--date. However, the same is not possible for the merge commit thatDOLT_MERGEgenerates, for example with--no-ffactive.The use case we have is that we would like to generate some 'fixtures' or fake commits with older timestamps to generate a semi-realistic commit log for testing purposes. This works well enough with
dolt sqland the--dateflag for commits, but seems to be impossible for merge commits, specifically.So far I've found no good way to fake the time for these commits in Dolt:
LD_PRELOADing the library into the Dolt SQL server doesn't appear to work, nor does it work for thedolt sqlcommand - the README of the library mentions golang applications being possibly problematic, though.SET TIMESTAMP = UNIX_TIMESTAMP('1980-01-01T12:34:56');before doing a commit, but whilst Dolt SQL accepts the sets, subsequent calls toNOW()or doing commits still use the system time.My last resort is a full-blown VM where I have control over the time or setting system time globally outside the container (it is blocked by default and requires elevated privileges), but since it is tied to the host time, doing so is not great because it's not particularly cross-platform and breaks outside of the containers.