Commit 1c7f60bb7003

Vincent Demeester <vincent@sbr.pm>
2026-01-28 14:46:44
refactor(lazyworktree): remove main subdirectory detection
Worktrees are now stored in XDG_DATA_HOME instead of as siblings to a main checkout. Simplify repo detection to only check for .git. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 762a800
Changed files (1)
home
home/modules/lazyworktree.nix
@@ -81,7 +81,7 @@ in
       description = ''
         Directories to scan for automatic worktree alias discovery.
         Key is the prefix (wt<prefix><repo>), value is the directory path.
-        Repos with a 'main' subdirectory or .git are detected automatically.
+        Repos with .git are detected automatically.
       '';
     };
   };
@@ -147,9 +147,7 @@ in
                     local selection
                     selection=\$(ls -1 \"$base_dir\" 2>/dev/null | fzf --prompt=\"$base_dir: \")
                     [[ -n \"\$selection\" ]] || return 1
-                    if [[ -d \"$base_dir/\$selection/main\" ]]; then
-                      worktree_jump \"$base_dir/\$selection/main\" \"\$@\"
-                    elif [[ -d \"$base_dir/\$selection/.git\" ]]; then
+                    if [[ -d \"$base_dir/\$selection/.git\" ]]; then
                       worktree_jump \"$base_dir/\$selection\" \"\$@\"
                     else
                       echo \"Not a git repo: $base_dir/\$selection\" >&2
@@ -162,10 +160,8 @@ in
                     repo_name="$(basename "$repo_dir")"
                     target_dir=""
 
-                    # Determine target (main worktree or repo root)
-                    if [[ -d "$repo_dir/main" ]]; then
-                      target_dir="$repo_dir/main"
-                    elif [[ -d "$repo_dir/.git" ]]; then
+                    # Determine target (repo with .git)
+                    if [[ -d "$repo_dir/.git" ]]; then
                       target_dir="$repo_dir"
                     else
                       continue