Maintainer-side re-port of realies' #4288 (substance-approved by maphew
2026-07-27), redone against current main per bd-oibnz. The consolidation
half of the original PR (issues.go hand-rolled DOLT_ADD/DOLT_COMMIT sites
onto doltAddAndCommitInTx) already landed independently via #5341, so this
carries the remaining half: the empty-commit guards.
An idempotent no-op write (INSERT IGNORE duplicate, ON DUPLICATE KEY
re-writing the same value, UPDATE matching nothing) leaves its table clean,
so the selective DOLT_ADD stages nothing and DOLT_COMMIT('-m') fails
server-side with a 'nothing to commit' warning — flooding dolt.log at
reconcile cadence.
- issueops.HasStagedChanges: reports whether dolt_status has staged rows —
exactly what a '-m' commit would include.
- versioncontrolops.StageAndCommit: global HasPendingChanges fast-path
before staging, plus the precise HasStagedChanges guard before commit
(an unrelated dirty table must not trigger an empty '-m' commit).
- DoltStore.doltAddAndCommit / doltAddAndCommitInTx: staged-set guard
before commit (these stage a fixed table list, so only the staged check
applies). A guard-read failure in doltAddAndCommit is a plain error, not
a publication failure: nothing committed, nothing indeterminate.
- Tests: sqlmock discriminators asserting DOLT_COMMIT is NOT issued on an
empty staged set (they fail if a guard is reverted), integration
regression tests for no-op dependency writes and claim/close
over-suppression, and existing commit-boundary/draincall/phase harnesses
taught to serve the two new dolt_status guard reads.
Co-authored-by: realies <5107843+realies@users.noreply.github.com>