Skip to content

fix(git-push): only include new changes since last push - #144

Merged
geekgonecrazy merged 1 commit into
devfrom
fix/git-push-incremental-changes
Aug 3, 2026
Merged

geekgonecrazy merged 1 commit into
devfrom
fix/git-push-incremental-changes

Conversation

@geekgonecrazy

Copy link
Copy Markdown
Contributor

Problem

atomic git push was re-counting every atomic change in the view each time it ran, producing commits like 20 Atomic changes that grew with every push. It also didn't carry change messages over reliably — it capped at 20 entries and made redundant load_change calls for messages already loaded via headers.

You can see this clearly in the rocketchat-tui repo — each push shows "7 Atomic changes", "8 Atomic changes"... up to "20 Atomic changes", with the same messages repeating and accumulating.

Solution

Incremental change tracking

  • find_last_pushed_state() walks git history (first-parent mainline) to find the most recent commit with a matching Atomic-View trailer, then parses its Atomic-State (a Merkle hash).
  • This state is matched against the view's history to compute a start_idx — only changes after that position are included in the commit body and Atomic-Changes trailer.
  • Atomic-State always carries the latest view state so the next push can find this commit as its starting point.
  • First push (no prior atomic commit) falls back to including everything (backward compatible).
  • Direct git commits (no Atomic trailers) are skipped by the history walk.

Change messages

  • synthesize_message() now reads from the already-loaded HistoryEntry::message() (via load_headers(true)) instead of making redundant repo.load_change() calls.
  • The .take(20) cap is removed — all new changes' messages are included (naturally bounded by what's new since the last push).

Additional improvements

  • Atomic-Changes trailer lists only the new change hashes (no more (+N earlier) truncation).
  • Empty new-history (manual working-copy edits) falls back to "Working copy changes".
  • Added parse_trailer() helper + tests.

Testing

  • All 1537 CLI tests pass
  • cargo clippy clean (no new warnings)
  • cargo build clean

atomic git push was re-counting every atomic change in the view each
time, producing commits like "20 Atomic changes" that grew with every
push. It also capped the synthesized message at 20 entries and made
redundant load_change calls for messages already loaded via headers.

Changes:
- Track the last pushed Atomic-State by walking git history (first-parent
  mainline) for a matching Atomic-View trailer, then use that state to
  find the position in the view's history. Only changes after that
  position are included in the commit body and Atomic-Changes trailer.
- Atomic-State always carries the latest view state so the next push can
  find this commit as its starting point.
- synthesize_message now reads from the already-loaded HistoryEntry
  headers instead of making redundant load_change calls, and the .take(20)
  cap is removed since the new-change set is naturally bounded.
- Atomic-Changes trailer lists only the new change hashes (no more
  (+N earlier) truncation).
- Added parse_trailer helper + tests.
- Direct git commits (no Atomic trailers) are skipped by the history walk.
@geekgonecrazy
geekgonecrazy force-pushed the fix/git-push-incremental-changes branch from 38775e0 to 80fe0c4 Compare August 2, 2026 00:52
@geekgonecrazy
geekgonecrazy merged commit 813e20e into dev Aug 3, 2026
8 checks passed
@geekgonecrazy
geekgonecrazy deleted the fix/git-push-incremental-changes branch August 3, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants