Skip to content

Commit 709b66b

Browse files
committed
fix(release): use git -C for robust sandbox git setup
Use explicit git -C $SANDBOX_DIR for all git operations instead of relying on cd, and add --allow-empty to ensure the initial commit always succeeds regardless of git version or configuration.
1 parent 0989925 commit 709b66b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

release.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,13 @@ function release::sandbox::create() {
403403
}
404404

405405
function release::sandbox::setup_git() {
406+
git init --quiet "$SANDBOX_DIR"
407+
git -C "$SANDBOX_DIR" checkout -b main 2>/dev/null || true
408+
git -C "$SANDBOX_DIR" config user.name "Release Sandbox"
409+
git -C "$SANDBOX_DIR" config user.email "sandbox@local"
410+
git -C "$SANDBOX_DIR" add --all
411+
git -C "$SANDBOX_DIR" commit --quiet --allow-empty -m "Initial sandbox state"
406412
cd "$SANDBOX_DIR"
407-
git init --quiet
408-
git checkout -b main 2>/dev/null || true
409-
git config user.name "Release Sandbox"
410-
git config user.email "sandbox@local"
411-
git add .
412-
git commit --quiet -m "Initial sandbox state"
413413
release::log_verbose "Initialized git repository in sandbox"
414414
}
415415

0 commit comments

Comments
 (0)