Skip to content

Conversation

codeaucafe
Copy link
Contributor

Summary

This PR implements GitHub issue #1374, adding support for distinguishing between commit author (who wrote the changes) and committer (who created the commit), matching
Git's commit metadata model. This enables better attribution in scenarios like rebasing, cherry-picking, and applying patches.

Key Changes

Core Implementation (28a7d9b)

Data Structure Updates:

  • Added new CommitMeta fields: AuthorName, AuthorEmail, AuthorDate, CommitterName, CommitterEmail, CommitterDate
  • Updated Flatbuffer schema (commit.fbs) with new author/committer fields
  • Bumped metadata version to v2.0 for new commit format

CLI Enhancements:

  • Added --committer flag to specify committer separately from author
  • Added --committer-date flag to set custom committer timestamp
  • Existing --author flag continues to work as before

Environment Variable Support:

  • DOLT_AUTHOR_DATE - Sets author timestamp
  • DOLT_COMMITTER_DATE - Sets committer timestamp

SQL Integration:

  • Updated DOLT_COMMIT stored procedure to accept new committer parameters
  • Enhanced dolt_commits system table with new columns: author, author_email, author_date, committer, committer_email, committer_date
  • Updated dolt_log display to show author information

Backward Compatibility:

  • ✅ Fully backward compatible - old Dolt clients can read new commits
  • ✅ Forward compatible - new clients handle old commits seamlessly
  • ✅ Zero breaking changes to existing workflows
  • Deprecated fields (name, email, timestamp) maintained for compatibility

Test Coverage (5ed518f)

Comprehensive BATS Test Suite:

  • 14 test cases covering all functionality
  • CLI flag validation (--author, --committer, --committer-date)
  • Environment variable behavior (DOLT_AUTHOR_DATE, DOLT_COMMITTER_DATE)
  • SQL procedure integration with new parameters
  • Database schema verification (new columns in dolt_commits)
  • Backward compatibility with existing column names
  • Default behavior and error handling
  • Display integration (dolt log shows author info)

Default Behavior

When committer info is not specified:

  • Committer defaults to author information
  • Maintains existing Dolt behavior for all current workflows

When only partial info is provided:

  • Missing author info uses Git configuration (user.name, user.email)
  • Missing committer info defaults to author values

Refs: #1374

Add support for distinguishing between commit author (who wrote the
changes) and committer (who created the commit), matching Git's commit
metadata model. This allows for better attribution in scenarios like
rebasing, cherry-picking, and applying patches.

BREAKING CHANGE: CommitMeta struct now uses AuthorName/AuthorEmail
instead of Name/Email. The old fields are deprecated but maintained for
backward compatibility. Commits will be written in a new v2.0 format
that includes both author and committer information.

- Add new CommitMeta fields: AuthorName, AuthorEmail, AuthorDate,
CommitterName, CommitterEmail, CommitterDate
- Update Flatbuffer schema with new author/committer fields
- Add CLI flags: --committer and --committer-date
- Update DOLT_COMMIT SQL procedure to accept committer parameters
- Add new columns to dolt_commits and dolt_log system tables
- Support DOLT_AUTHOR_DATE and DOLT_COMMITTER_DATE environment variables
- Maintain full backward compatibility for reading/writing old format
commits
- Update all display functions to use new author fields

The implementation ensures that:
- Old Dolt clients can read new commits (using deprecated fields)
- New Dolt clients can read old commits (copying to both
author/committer)
- Default behavior unchanged when committer info not specified

Refs: dolthub#1374
Tests cover CLI flags, environment variables,
SQL integration, backward compatibility, and error handling.

Includes 14 test cases verifying:
- --author and --committer flag behavior
- DOLT_AUTHOR_DATE and DOLT_COMMITTER_DATE env vars
- SQL stored procedure integration
- Database schema changes (dolt_commits table)
- Backward compatibility with existing columns
- Default behavior and error conditions

Refs: dolthub#1374
@codeaucafe codeaucafe changed the title feat(commit): distinguish between commit author and committer dolthub/dolt:1374 - feat(commit): distinguish between commit author and committer Aug 7, 2025
@codeaucafe codeaucafe changed the title dolthub/dolt:1374 - feat(commit): distinguish between commit author and committer dolthub/dolt#1374 - feat(commit): distinguish between commit author and committer Aug 7, 2025
@codeaucafe codeaucafe closed this Aug 8, 2025
@codeaucafe
Copy link
Contributor Author

codeaucafe commented Aug 8, 2025

Closed given @elianddb is working on this, see #9645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants