Skip to content

Commit cdf0c7c

Browse files
Fix AGENTS.md stuck on Git-dependent scripts in Jujutsu workspace
1 parent 78eada5 commit cdf0c7c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.codex/style/worktrees.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,26 @@ jj diff -r changeid2 # Fix bar
4242
It should be rare that the prompter has to `cd` into the temp worktree to review
4343
changes. Mention that only when a command must run from the worktree, or when
4444
the prompter must inspect VCS-ignored files.
45+
46+
47+
## Git-Dependent Scripts In JJ Workspaces
48+
49+
Some scripts may shell out to `git` even when the active checkout is a
50+
non-colocated jj workspace without a `.git` directory. If a check fails with
51+
`fatal: not a git repository`, do not give up immediately. Retry with Git
52+
pointed at the original colocated repository and the current jj workspace as the
53+
work tree:
54+
55+
```sh
56+
GIT_DIR=/path/to/original/repo/.git \
57+
GIT_WORK_TREE="$PWD" \
58+
<command>
59+
```
60+
61+
If the command runs through a task runner that filters environment variables,
62+
also pass whatever setting is needed for that runner to preserve `GIT_DIR` and
63+
`GIT_WORK_TREE`. Prefer the runner's own environment-variable override when it
64+
has one, so the workaround can live in the command environment instead of every
65+
runner invocation. For example, Turbo projects can use `TURBO_ENV_MODE=loose`.
66+
Other monorepo tooling may have its own workaround when it is sensitive to
67+
environment filtering.

0 commit comments

Comments
 (0)