Skip to content

Commit

Permalink
Deploy Production Code for Commit 8a308cc πŸš€
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed May 17, 2024
1 parent 8a308cc commit 15e706b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/worktree.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ function generateWorktree(action, worktreedir, branchExists) {
if (branchExists) {
yield (0, execute_1.execute)(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent);
}
yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
// Check if the branch is already checked out in another worktree
try {
(0, child_process_1.execSync)(`git rev-parse --verify --quiet ${action.branch}`);
// If the command succeeds, the branch is already checked out
(0, core_1.info)(`Branch ${action.branch} is already checked out. Using existing worktree.`);
}
catch (error) {
// If the command fails, the branch is not checked out
yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
}
const checkout = new GitCheckout(action.branch);
if (branchExists) {
// There's existing data on the branch to check out
Expand Down

0 comments on commit 15e706b

Please sign in to comment.