Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Refine worktree target/ seeding strategy

Maximilian Roosae7afc6f1ea5
diff --git a/.config/wt.toml b/.config/wt.toml
index 3062f46db..c0f713585 100644
--- a/.config/wt.toml
+++ b/.config/wt.toml
@@ -6,15 +6,15 @@
# {{ branch }} - Branch name with slashes replaced by dashes
# {{ worktree }} - Path to the new worktree
# {{ repo_root }} - Path to the main repository root
-# Seed target/ from base worktree using CoW (copy-on-write)
-# Each worktree gets its own target/ (avoids incremental build corruption)
-# but seeded from base to warm-start builds (low disk usage)
+# Seed compiled dependencies from base worktree using CoW (copy-on-write)
+# Copies essential files (~7.5k), skipping 184k+ .rcgu.o incremental objects
+# Result: ~3 seconds instead of ~68 seconds
# macOS: uses cp -c (clonefile on APFS)
-# Linux: would need cp --reflink=auto (GNU coreutils) or rsync 3.2.3+ with --reflink
post-start = """
-[ -d {{ repo_root }}/target ] &&
-[ ! -e {{ worktree }}/target ] &&
-cp -cR {{ repo_root }}/target/. {{ worktree }}/target/
+[ -d {{ repo_root }}/target/debug/deps ] && [ ! -e {{ worktree }}/target ] &&
+mkdir -p {{ worktree }}/target/debug/deps &&
+cp -c {{ repo_root }}/target/debug/deps/*.rlib {{ repo_root }}/target/debug/deps/*.rmeta {{ worktree }}/target/debug/deps/ &&
+cp -cR {{ repo_root }}/target/debug/.fingerprint {{ repo_root }}/target/debug/build {{ worktree }}/target/debug/
"""
# Post-merge hooks