Skip to content

fix(sync): stage .gitignore during init so first commit is never empty#86

Merged
iamtouchskyer merged 1 commit into
iamtouchskyer:mainfrom
imink:fix/sync-init-empty-repo
Apr 29, 2026
Merged

fix(sync): stage .gitignore during init so first commit is never empty#86
iamtouchskyer merged 1 commit into
iamtouchskyer:mainfrom
imink:fix/sync-init-empty-repo

Conversation

@imink

@imink imink commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix: sync --init failed with src refspec HEAD does not match any when ~/.memex had no cards. The root cause was that only cards/ and archive/ were staged before the initial commit — both are empty dirs that git can't track, so the commit silently failed and HEAD never resolved.
  • Fix: Stage .gitignore (always created during init) so the initial commit always has content.
  • Enhancement: init() now returns the resolved repo URL; CLI prints Sync initialized with <url> instead of the generic message.

Test plan

  • All 35 sync tests pass
  • Manual test: rm -rf ~/.memex/.git ~/.memex/.sync.json && memex sync --init succeeds on an empty memex directory
  • Verified output: Sync initialized with https://github.com/imink/memex-cards

🤖 Generated with Claude Code

When ~/.memex has no cards yet, `git add cards` has nothing to stage
(git can't track empty dirs). The initial commit silently failed,
leaving HEAD unresolvable, which caused `git push -u origin HEAD` to
error with "src refspec HEAD does not match any".

Fix: stage .gitignore (always created during init) so the commit
always has content. Also return the resolved repo URL from init() and
print it in the CLI output.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@iamtouchskyer
iamtouchskyer merged commit 2efad67 into iamtouchskyer:main Apr 29, 2026
6 checks passed
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