You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed an issue where creating worktrees from HEAD in non-bare repositories could fail when using relative paths like `../worktree-name`. The fix ensures that relative paths are resolved from the current working directory rather than from the git directory.
280
+
281
+
**Root Cause**: The `git worktree add` command was being executed with `current_dir` set to the git directory, causing relative paths to be interpreted incorrectly.
282
+
283
+
### v0.3.0 Security and Robustness Improvements
284
+
285
+
#### Worktree Name Validation
286
+
287
+
Added comprehensive validation for worktree names to prevent issues:
-**Non-ASCII Warning**: Warns users about potential compatibility issues with non-ASCII characters
292
+
-**Length Limits**: Enforces 255-character maximum for filesystem compatibility
293
+
-**Hidden Files**: Prevents names starting with `.` to avoid hidden file conflicts
294
+
295
+
#### File Copy Size Limits
296
+
297
+
Enhanced file copy functionality with safety checks:
298
+
299
+
-**Large File Skipping**: Automatically skips files larger than 100MB with warnings
300
+
-**Performance Protection**: Prevents accidental copying of build artifacts or large binaries
301
+
-**User Feedback**: Clear warnings when files are skipped due to size
302
+
303
+
#### Concurrent Access Control
304
+
305
+
Implemented file-based locking to prevent race conditions:
306
+
307
+
-**Process Locking**: Uses `.git/git-workers-worktree.lock` to prevent concurrent worktree creation
308
+
-**Stale Lock Cleanup**: Automatically removes locks older than 5 minutes
309
+
-**Error Messages**: Clear feedback when another process is creating worktrees
310
+
-**Automatic Cleanup**: Lock files are automatically removed when operations complete
311
+
312
+
#### Custom Path Validation
313
+
314
+
Added comprehensive validation for user-specified worktree paths:
315
+
316
+
-**Path Security**: Validates against path traversal attacks and excessive directory navigation
317
+
-**Cross-Platform Compatibility**: Checks for Windows reserved characters even on non-Windows systems
318
+
-**Git Reserved Names**: Prevents conflicts with git internal directories in path components
319
+
-**Path Format Validation**: Ensures proper relative path format (no absolute paths, no trailing slashes)
320
+
321
+
**Solution**: Convert relative paths to absolute paths before passing them to the git command, ensuring consistent behavior regardless of the working directory.
322
+
323
+
## Test Coverage
324
+
325
+
The following test files have been added/updated for v0.3.0:
326
+
327
+
-`tests/worktree_path_test.rs`: 10 tests for path resolution edge cases
328
+
-`tests/create_worktree_integration_test.rs`: 5 integration tests including bare repository scenarios
329
+
-`tests/worktree_commands_test.rs`: 3 new tests for HEAD creation patterns
330
+
-`tests/validate_worktree_name_test.rs`: 7 tests for name validation including edge cases
331
+
-`tests/file_copy_size_test.rs`: 6 tests for file size limits and copying behavior
332
+
-`tests/worktree_lock_test.rs`: 5 tests for concurrent access control
333
+
-`tests/validate_custom_path_test.rs`: 9 tests for custom path validation including security checks
334
+
- Enhanced `tests/create_worktree_integration_test.rs`: 2 additional tests for custom path creation
0 commit comments