Closed
Conversation
When docker-git auth github login is called, immediately ensure the user's .docker-git state repository exists on GitHub: - Resolve the authenticated user's login via gh api /user - Check if <login>/.docker-git exists; create it if missing - Initialise the local ~/.docker-git directory via stateInit Shared gh API helpers extracted to github-api-helpers.ts to eliminate code duplication between github-fork and state-repo-github. Closes ProverCoderAI#141 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-less (issue-141) - Add `adoptRemoteHistoryIfOrphan` in state-repo.ts called between `ensureOriginRemote` and `checkoutBranchBestEffort` in `stateInit`; when the repo is on an orphan branch (no commits) it fetches remote history and soft-resets to it so that local files appear as staged changes on top of the existing remote tree — preventing a divergent root commit that would force a new branch on push. - Add integration tests in state-repo-init.test.ts covering: clone from empty dir, orphan-adoption from pre-populated dir, and idempotency. - Add unit tests in github-api-helpers.test.ts documenting the `runGhApiNullable` invariants (CommandFailedError → null, empty → null). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… ancestor
Previously adoptRemoteHistoryIfOrphan only handled orphan branches
(no local commits). If stateInit was called a second time, the local
repo already had a divergent root commit (from a prior git-init run),
so rev-parse HEAD succeeded and the function returned early — leaving
the histories unrelated and forcing a new branch on every sync.
Now the function also covers Case 2: local commits exist but
`git merge-base HEAD origin/<ref>` finds no common ancestor.
In that case a `git reset --soft origin/<ref>` aligns the local HEAD
with the remote, keeping all local file changes as staged, so
`stateSync` can commit and push to main without conflict.
INVARIANT: ∀ local ∈ Repos: ¬∃ancestor(local, remote) → reset_soft(remote)
∧ ∃ancestor(local, remote) → rebase_sync(local, remote)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ve local history Using git reset --soft discards local commits. Replace with git merge --allow-unrelated-histories -X ours so both the local and remote root commits are preserved in the graph. Local files win on conflict, which is the correct default for a state repo. INVARIANT: ∀ local ∈ Repos: ¬∃ancestor(local, remote) → merge_unrelated(local, remote, ours) ∧ ∃ancestor(local, remote) → rebase_sync(local, remote) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove -X ours: conflicts are not auto-resolved. Instead, on a failed merge the repo is restored via --abort and stateSync handles the rest — it will push a branch and log a PR URL for manual resolution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 tasks
- git init now uses --initial-branch=main to avoid creating master - gitBaseEnv sets GIT_AUTHOR/COMMITTER_NAME/EMAIL to prevent "Author identity unknown" errors on commit and merge - Extract adoptRemoteHistoryIfOrphan to state-repo/adopt-remote.ts to satisfy max-lines lint rule Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
No description provided.