fix: sandbox-friendly git tests and linked-gitdir support - #79
Open
simtel12 wants to merge 1 commit into
Open
Conversation
- Integration tests use git init --separate-git-dir, scratch under target/, local gpgsign disabled, and cleanup of sibling .git dir. - Resolve real git directory via rev-parse for rebase detection and pgit-sync-state when using separate git directories. Add AGENTS.md with build, test, and clippy/fmt commands. Co-authored-by: Cursor <cursoragent@cursor.com>
hokwangchoi
approved these changes
May 12, 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
Some environments (including constrained sandboxes) block writes under a worktree’s
.gitdirectory while still allowing a sibling git directory. Repositories created withgit init --separate-git-diralso keep metadata outside<worktree>/.git. This pull request resolves the real Git directory viagit rev-parse, uses it for rebase detection andpgit-sync-state.json, and updates integration tests to use separate git dirs undertarget/with an optionalPGIT_TEST_TMPoverride.Changes
Repo::git_directory(): Resolves the absolute git directory usinggit rev-parse --absolute-git-dir, with fallback to--git-dirand path normalization relative to the worktree when Git returns a relative path.is_rebase_in_progress,read_sync_state, andwrite_sync_stateread and write under the resolved git directory instead of assuming.git/lives directly inside the worktree.tests/test_git_ops.rs): Ephemeral repos usegit init --separate-git-dir; scratch roots default totarget/pgit-integration-tmp/(override withPGIT_TEST_TMP); commit/tag GPG signing is disabled in-repo so tests do not depend on~/.gnupg; teardown removes both the worktree and the companion git directory.AGENTS.md: Documents the usualcargo build,cargo test, Clippy, andrustfmt --checkworkflow for contributors.Test plan
cargo test(library unit tests andtest_git_opsintegration tests)