From 515358d34b5cbdc647c6a699b903c496819ef34b Mon Sep 17 00:00:00 2001 From: James Ives Date: Fri, 17 May 2024 16:49:54 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20Production=20Code=20for=20Commit=20613?= =?UTF-8?q?8e5cb0249138182535f87f6382e49ca2c7613=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/worktree.js | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/lib/worktree.js b/lib/worktree.js index a5f0468cb..ce575c0e5 100644 --- a/lib/worktree.js +++ b/lib/worktree.js @@ -13,7 +13,6 @@ exports.generateWorktree = exports.GitCheckout = void 0; const core_1 = require("@actions/core"); const execute_1 = require("./execute"); const util_1 = require("./util"); -const child_process_1 = require("child_process"); class GitCheckout { constructor(branch) { this.orphan = false; @@ -21,22 +20,13 @@ class GitCheckout { this.branch = branch; } toString() { - // Check if the branch is already checked out in another worktree - try { - (0, child_process_1.execSync)(`git rev-parse --verify --quiet ${this.branch}`); - // If the command succeeds, the branch is already checked out - return `git checkout ${this.branch}`; - } - catch (error) { - // If the command fails, the branch is not checked out - return [ - 'git', - 'checkout', - this.orphan ? '--orphan' : '-B', - this.branch, - this.commitish || '' - ].join(' '); - } + return [ + 'git', + 'checkout', + this.orphan ? '--orphan' : '-B', + this.branch, + this.commitish || '' + ].join(' '); } } exports.GitCheckout = GitCheckout; @@ -50,16 +40,11 @@ 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); } - // 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); - } + // await 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