Dashboard › Code › Distillation
1a111b97-9560-4c73-bd7a-e05253ecd659["lore_tm_v1_AoDBJlSBR4VMuvJumtwg1NgnN37bC_rK63yGMYpa15A","lore_tm_v1_Iv996WcbP_6-dHTAE7TnLTInffnkBWi2VsSYzu0HFgg","lore_tm_v1_2aCnJT05f6zrmC_qZAXukVpEKnpkuaWs9W2rzcM6_74","lore_tm_v1_T9a8uasHobMLk99YsFAUnSfYbqIGPqK2ghQUZYUTSlc","lore_tm_v1_ZcQINrbo04HAYbRc5tNG9MkVc3PUoHFGYAYHiep5YFQ","lore_tm_v1_XsWY7SIT-NPIqJarA0OjjiRZX37ZjJ7NYwaixqlX91I","lore_tm_v1_pDgue_rj9zgLiUPFg1xCvpGoJ13rD5iDjPTkMg6g1C4","lore_tm_v1_1TamyMtycFbjUnsQfXzt9MZyfuiHM1m_xSH0KZ8A3bY","lore_tm_v1_q14agaseXUnVtUMX7wPqFBoEraN0IyWRbP9TJAa9-qA","lore_tm_v1_sU-n62cAP36razZXvPH8r6UWOPraIPnJ6L6ghwObT0M","lore_tm_v1_1pcJx8WFDwU0bouc432TSUVwRbVJKwu_u0CMqc_ZY5s","lore_tm_v1_UljuZUCpabCIphrQ33RtLsysil-obCXO-qXonFMtltE","lore_tm_v1_gdWqhleLSFp44o9RO7dUjmFu0xntFlFokrIc-W-9Pus","lore_tm_v1_WtzJ6HGKatbijYUNZfX-ibe4RSpMlO2DGrAesESeSUQ","lore_tm_v1_CZeOqazQdSauUduJ-kkHeJ_qrc9GEuEereYkigCpAtw"]
Date: Sep 8, 2026
/home/byk/.cargo/git/checkouts/jj-93980d4c75ceb43f/2133040/cli/src/commands/workspace/add.rs lines 43–260. WorkspaceAddArgs defines SparseInheritance::{Copy, Full, Empty}, destination, optional --name, repeatable --revision/-r (alias --revisions), --message/-m, --colocate, --no-colocate, and --sparse-patterns defaulting to Copy. In cmd_workspace_add(), should_colocate is true for --colocate, false for --no-colocate, otherwise old_workspace_command.working_copy_shared_with_git() && settings.get_bool("git.colocate"); when true it calls create_worktree(repo.store(), GitSubprocessOptions::from_settings(...), &destination_path) and prints Created Git worktree for the new workspace. before initializing the JJ workspace.-r @-, then assert Git HEAD points to the requested parent rather than the main workspace’s HEAD.FileSystem.access (/home/byk/Code/jj-colocate-validation) returned NotFound./home/byk/Code/jj-colocate-validation did not exist; planned to create the disposable repository before running revision and Git-worktree assertions.737ae9c9 (first) and 83fa2350 (second); jj workspace add created Git worktree ../jj-colocate-validation-workspace, then created working-copy commit 358eacef whose parent was 737ae9c9 (first).HEAD with the JJ commit mapping and then delete disposable repositories.create_worktree matches: lib/src/git.rs:1848 defines pub fn create_worktree(; lib/src/git.rs:1899 describes unlink_worktree() as its inverse; cli/src/commands/workspace/add.rs:25 imports jj_lib::git::create_worktree; and cli/src/commands/workspace/add.rs:160 calls it./home/byk/.cargo/git/checkouts/jj-93980d4c75ceb43f/2133040/lib/src/git.rs lines 1800–1909. create_worktree() (lines 1841–1881) creates a Git worktree at destination for a new JJ workspace using a randomized orphan branch named jj-worktree-{random 16-digit hexadecimal}, then nullifies HEAD; JJ populates the working copy, and later reset_head() exports HEAD to the parent of the new working-copy commit. unlink_worktree() removes the .git gitlink and Git metadata under .git/worktrees/ while leaving directory contents.-r @- test was inconclusive because @- equals the main workspace’s exported Git HEAD by design; planned to rerun with a deliberately different existing revision and remove both disposable workspaces via JJ.Created Git worktree for the new workspace.: five in cli/tests/test_workspaces.rs at lines 2156, 2170, 2259, 2332, and 2350, plus the status-message write in cli/src/commands/workspace/add.rs:161./home/byk/.cargo/git/checkouts/jj-93980d4c75ceb43f/2133040/cli/tests/test_workspaces.rs lines 2104–2399. test_workspaces_add_forget_colocated() verifies: --no-colocate overrides the colocated default; --config=git.colocate=false also prevents creation; --colocate overrides that config; with colocated main workspace and git.colocate = true, workspace add creates a .git file and .jj/.gitignore; and workspace forget secondary removes the Git worktree/gitlink while preserving files and leaves no orphan local branch.test_workspaces_add_colocated_at_revision(): after commits one, two, and three, it runs workspace add -r @--- ../secondary; Git HEAD in secondary must equal the commit ID for @--- (the one commit), not the main workspace tip; only file1 exists, while file2 and file3 do not; and modifying secondary/file1 is visible to both jj diff and Git status.test_workspaces_add_colocated_unborn_head(): an empty colocated repository can create a workspace with Git HEAD at refs/jj/root; after an initial commit, a workspace created with -r root() also has HEAD at refs/jj/root and does not contain file.-r target rather than the main workspace tip; planned to reproduce the exact non-tip case locally and then remove all validation state.