Skip to content

Commit 6cc740a

Browse files
committed
fix: guard set -e footgun in _fast_copy_dir and reset cache in tests
- Use if/fi instead of && for partial-clone cleanup to avoid exit code 1 leaking under set -e when target doesn't exist - Reset _fast_copy_os in test setup for deterministic test isolation
1 parent 48a1630 commit 6cc740a

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/copy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ _fast_copy_dir() {
9797
fi
9898
# Clean up any partial clone output before fallback
9999
local _clone_target="${dest%/}/$(basename "$src")"
100-
[ -e "$_clone_target" ] && rm -rf "$_clone_target"
100+
if [ -e "$_clone_target" ]; then rm -rf "$_clone_target"; fi
101101
cp -RP "$src" "$dest"
102102
;;
103103
linux)

tests/copy_safety.bats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
setup() {
44
load test_helper
5+
_fast_copy_os=""
56
source "$PROJECT_ROOT/lib/platform.sh"
67
source "$PROJECT_ROOT/lib/copy.sh"
78
}

0 commit comments

Comments
 (0)