dolthub/dolt#1374: Add separate author and committer support
Fixes dolthub/dolt#1374
Companion dolthub/doltgresql#2039
Dolt now supports separate author and committer information for commits! Committer time is set when the commit is written to storage. dolt_log and dolt_log() now show author-related columns as the last columns in their tables, this includes optional columns in dolt_log().
⚠️ The committer columns now show the real committer data in commit-related system tables. Previous versions of Dolt would display author names, emails and dates within committer related columns. This should not cause any issues, however, to stay backward compatible, when
doltconnects to an older sql-server it'll switch back to this methodology to read commit metadata fromdolt_logwhen running commands, i.e.dolt log,dolt show, etc.
Users can set committer name and email using the DOLT_COMMITTER_NAME and DOLT_COMMITTER_EMAIL environment variables. The dolt_log tables' author columns can be controlled with the dolt_log_committer_only system variable for any workflows that may rely on the original view.
export DOLT_COMMITTER_NAME="Committer User"
export DOLT_COMMITTER_EMAIL="[email protected]"
You can also set a custom committer date using the DOLT_COMMITTER_DATE environment variable, an existing feature:
export DOLT_COMMITTER_DATE="2025-01-01T12:00:00Z"
dolt commit -m "Commit with custom committer date"
dolt sql -q "SELECT commit_hash, committer, email, date, message FROM dolt_log LIMIT 1;"
+----------------------------------+----------------+-----------------------+---------------------+-----------------------------------+
| commit_hash | committer | email | date | message |
+----------------------------------+----------------+-----------------------+---------------------+-----------------------------------+
| tdf81ch4ug4c9uc2p78rls1iihj95unn | Committer User | [email protected] | 2025-01-01 12:00:00 | Commit with custom committer date |
+----------------------------------+----------------+-----------------------+---------------------+-----------------------------------+
When the dolt_log_committer_only system variable is set to true, only committer information is shown in the table, a.k.a. the now legacy view:
SET @@dolt_log_committer_only = true;
+----------------------------------+----------------+-----------------------+---------------------+--------------------------------------+--------------+
| commit_hash | committer | email | date | message | commit_order |
+----------------------------------+----------------+-----------------------+---------------------+--------------------------------------+--------------+
| tdf81ch4ug4c9uc2p78rls1iihj95unn | Committer User | [email protected] | 2025-01-01 12:00:00 | Commit with custom committer date | 4 |
| 0gonkh11sf1esld53b66jdpbu78sdq6i | Committer User | [email protected] | 2025-11-19 10:15:43 | Add Charlie with different committer | 3 |
+----------------------------------+----------------+-----------------------+---------------------+--------------------------------------+--------------+
When set to false (default), author columns are included:
+----------------------------------+----------------+-----------------------+---------------------+--------------------------------------+--------------+-----------+------------------+---------------------+
| commit_hash | committer | email | date | message | commit_order | author | author_email | author_date |
+----------------------------------+----------------+-----------------------+---------------------+--------------------------------------+--------------+-----------+------------------+---------------------+
| tdf81ch4ug4c9uc2p78rls1iihj95unn | Committer User | [email protected] | 2025-01-01 12:00:00 | Commit with custom committer date | 4 | Test User | [email protected] | 2025-11-19 10:15:47 |
| 0gonkh11sf1esld53b66jdpbu78sdq6i | Committer User | [email protected] | 2025-11-19 10:15:43 | Add Charlie with different committer | 3 | Test User | [email protected] | 2025-11-19 10:15:43 |
+----------------------------------+----------------+-----------------------+---------------------+--------------------------------------+--------------+-----------+------------------+---------------------+
⚠️ On older clients, persisting
dolt_log_committer_onlywill print a warning that it can't be found.dolt_loganddolt_log()can still read the system variable correctly in this sql-server version and will adjust their output to match the above.
-
CommitStagedPropsandCommitMetastruct now includeCommitterNameandCommitterEmailfields that default to author values when not specified. - Added
CommitterTime()andFormatCommitterTS()methods toCommitMetaforgitformatting. -
CommitMeta.Timestampchanged fromuint64to*uint64to support deferred initialization at commit write time and force explicit initialization. - Added
NewCommitMetaWithAuthorCommitterfunction to create commit metadata with separate author and committer information. - Added
DOLT_COMMITTER_NAMEandDOLT_COMMITTER_EMAILenvironment variables. - Flatbuffer schema now includes optional
committer_nameandcommitter_emailfields. - Committer-related system tables now display committer information instead of author information in committer columns.
-
dolt_logtable and table function includes optional author columns controlled bydolt_log_committer_onlysystem variable. These are appended at the end, after any optional columns indolt_log()'s case, to stay forward compatible with fixed indices of previous dolt clients. - Commit readers read committer fields or normalize on author information when missing said fields for both flatbuffer and Noms formats.
- Cherry-pick and merge operations preserve committer information from source commits.
- Added
sql-server.batsintegration test incompatibilitydirectory to make sure commit-related commands remain forward and backward compatible for specified versions in.txtfiles.
@elianddb DOLT
| comparing_percentages |
|---|
| 100.000000 to 100.000000 |
| version | result | total |
|---|---|---|
| a7811ea | ok | 5937471 |
| version | total_tests |
|---|---|
| a7811ea | 5937471 |
| correctness_percentage |
|---|
| 100.0 |
@elianddb DOLT
| comparing_percentages |
|---|
| 100.000000 to 100.000000 |
| version | result | total |
|---|---|---|
| 88f5a76 | ok | 5937471 |
| version | total_tests |
|---|---|
| 88f5a76 | 5937471 |
| correctness_percentage |
|---|
| 100.0 |