fix(claude-sync): commit what it adds instead of relying on chezmoi autoCommit - #529
Merged
Merged
Conversation
…utoCommit chezmoi commits by itself only when git.autoCommit is configured. Without it, chezmoi add/re-add only staged into the source dir, the local-ahead check saw no commit, and claude-sync printed 'nothing to push (already synced)' while changes piled up uncommitted (50 on this machine before a manual commit). - _claude_sync_commit stages and commits only the ~/.claude source subtree, so unrelated staged dotfile edits stay staged. - Default and --no-push now commit; --add commits before pushing. - Header now names flow-cli as the source (it said chezmoi-managed). - New tests/test-claude-sync.zsh (6 cases; fake chezmoi + real git against a throwaway bare origin), registered in run-all.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A --add of a path outside ~/.claude was staged by chezmoi but never committed, then the push reported success with nothing new. The commit helper now takes the target whose source path it commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Data-Wise
added a commit
that referenced
this pull request
Sep 23, 2026
* fix(claude-sync): skip memory dirs of $TMPDIR-rooted projects Test sandboxes and throwaway sessions under /private/var/folders leave ~/.claude/projects/-private-var-folders-*/memory dirs. Now that claude-sync commits (#529), those empty .keep dirs would land in dotfiles. 10 such dirs on this machine (68 memory dirs -> 58 synced). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(claude-sync): exclude $TMPDIR copies already in the source at commit Skipping -private-var-folders-* memory dirs at chezmoi-add time does not stop copies an earlier run already put in the source dir: the commit step's 'git add -A -- dot_claude' would still pick them up. Exclude them in the pathspec too. Dry run against the real dotfiles source: 5 such .keep files staged without the exclude, 0 with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Data-Wise
added a commit
that referenced
this pull request
Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude-syncassumed chezmoi commits automatically, but that only happens when chezmoi'sgit.autoCommitis configured, and it isn't on this machine. Sochezmoi addandre-addonly put files into the chezmoi source repo. The ahead-of-origin/maincheck then found no new commit, andclaude-syncprintednothing to push (already synced)while changes built up uncommitted. The dotfiles repo had collected 50 uncommitted changes before a manual commit (Data-Wise/dotfilesfc776f6)._claude_sync_commitadds and commits only the~/.claudepart of the source repo (chezmoi source-path ~/.claude). Other dotfile changes that are staged stay staged.--no-pushnow commit.--addnow commits before pushing (before, it pushed without committing).~/.config/zshlinks toflow-cli/zsh.Tests
New
tests/test-claude-sync.zsh, registered inrun-all.sh. It replaceschezmoiwith a shell function that copies files into a throwaway source repo whose remote is a local bare repo, so realgit commitandgit pushrun without touching real dotfiles.Before the fix, 4 of 6 failed. After it, 6 of 6 pass:
--no-push--addFull suite
./tests/run-all.sh: 86 passed, 3 failed, 0 timeout, 0 skipped. The 3 failures (test-doctor,e2e-em-dispatcher,test-atlas-contract) also fail with this change set aside viagit stash -u, so they're caused by this machine's setup and not by this PR.Not in this PR
Test runs leave memory folders for their temporary directories (
~/.claude/projects/-private-var-folders-*flow-test-sandbox-*). The default run adds every~/.claude/projects/*/memoryfolder, so it will now commit those empty.keepfiles too. Filtering them out is a separate change.🤖 Generated with Claude Code