@@ -69,6 +69,13 @@ source /path/to/git-workers/shell/gw.sh
6969
7070## Recent Changes
7171
72+ ### v0.3.0 File Copy Feature
73+
74+ - Automatically copy gitignored files (like ` .env ` ) from main worktree to new worktrees
75+ - Configurable via ` [files] ` section in ` .git-workers.toml `
76+ - Security validation to prevent path traversal attacks
77+ - Follows same discovery priority as configuration files
78+
7279### Branch Option Simplification
7380
7481- Reduced from 3 options to 2: "Create from current HEAD" and "Select branch (smart mode)"
@@ -79,6 +86,7 @@ source /path/to/git-workers/shell/gw.sh
7986- ** ` get_branch_worktree_map() ` ** : Maps branch names to worktree names, including main worktree detection
8087- ** ` list_all_branches() ` ** : Returns both local and remote branches (remote without "origin/" prefix)
8188- ** ` create_worktree_with_new_branch() ` ** : Creates worktree with new branch from base branch (supports git-flow style workflows)
89+ - ** ` copy_configured_files() ` ** : Copies files specified in config to new worktrees
8290
8391## Architecture
8492
96104├── repository_info.rs # Repository information display
97105├── input_esc_raw.rs # Custom input handling with ESC support
98106├── constants.rs # Centralized constants (strings, formatting)
107+ ├── file_copy.rs # File copy functionality for gitignored files
99108└── utils.rs # Common utilities (error display, etc.)
100109```
101110
@@ -194,7 +203,7 @@ Since Git lacks native rename functionality:
1942031 . Current directory (current worktree)
1952042 . Main/master worktree directories (fallback)
196205
197- ## v0.3.0 File Copy Feature (Planning )
206+ ## v0.3.0 File Copy Feature (Implemented )
198207
199208### Overview
200209
@@ -209,15 +218,18 @@ copy = [".env", ".env.local", "config/local.json"]
209218
210219# Optional: source directory (defaults to main worktree)
211220# source = "path/to/source"
212-
213- # Optional: destination directory (defaults to worktree root)
214- # destination = "path/to/dest"
215221```
216222
217- ### Implementation Plan
218-
219- 1 . ** Config Structure** : Add ` FilesConfig ` struct with ` copy ` , ` source ` , and ` destination ` fields
220- 2 . ** File Detection** : Find main worktree directory for source files
221- 3 . ** Copy Logic** : In ` post-create ` hook phase, copy specified files
222- 4 . ** Error Handling** : Warn on missing files but don't fail worktree creation
223- 5 . ** Security** : Validate paths to prevent directory traversal attacks
223+ ### Implementation Details
224+
225+ 1 . ** Config Structure** : ` FilesConfig ` struct with ` copy ` and ` source ` fields (destination is always worktree root)
226+ 2 . ** File Detection** : Uses same priority as config file discovery for finding source files
227+ 3 . ** Copy Logic** : Executes after worktree creation but before post-create hooks
228+ 4 . ** Error Handling** : Warns on missing files but continues with worktree creation
229+ 5 . ** Security** : Validates paths to prevent directory traversal attacks
230+ 6 . ** Features** :
231+ - Supports both files and directories
232+ - Recursive directory copying
233+ - Symlink detection with warnings
234+ - Maximum directory depth limit (50 levels)
235+ - Preserves file permissions
0 commit comments