Skip to content

Commit 45b51f3

Browse files
committed
docs(fix): Verify isolated worktree creation
why: A fixed temporary path and diagnostic-output assertion masked an unsuccessful example behind automatic test retries. what: Require native creation in the fixture directory and verify its Git metadata and checked-out revision.
1 parent 8a11477 commit 45b51f3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/libvcs/cmd/git.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6870,10 +6870,16 @@ def add(
68706870
68716871
Examples
68726872
--------
6873-
>>> GitWorktreeManager(path=example_git_repo.path).add(
6874-
... path='/tmp/test-worktree-add', commit_ish='HEAD'
6873+
>>> worktree_path = tmp_path / "linked"
6874+
>>> _ = GitWorktreeManager(path=example_git_repo.path).add(
6875+
... path=worktree_path, commit_ish="HEAD", detach=True,
6876+
... check_returncode=True,
68756877
... )
6876-
"Preparing worktree (detached HEAD ...)..."
6878+
>>> (worktree_path / ".git").is_file()
6879+
True
6880+
>>> revision = Git(path=worktree_path).rev_parse(args="HEAD").strip()
6881+
>>> revision == example_git_repo.get_revision()
6882+
True
68776883
"""
68786884
local_flags: list[str] = []
68796885

0 commit comments

Comments
 (0)