From c2d07551a3a1789daa700e38108cde981c6f9f54 Mon Sep 17 00:00:00 2001 From: Andrew Ross Date: Wed, 26 Oct 2022 09:55:52 -0700 Subject: [PATCH] Put worktree outside of repo in manual steps If a backport fails then steps are given to create a backport manually. Currently, these steps put the worktree inside the repository folder, which causes git to see the worktree as untracked files. This change puts the worktree outside of the repository to avoid this problem. Signed-off-by: Andrew Ross --- src/backport.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backport.ts b/src/backport.ts index a47a202..964a7c5 100644 --- a/src/backport.ts +++ b/src/backport.ts @@ -154,7 +154,7 @@ const getFailedBackportCommentBody = ({ errorMessage: string; head: string; }) => { - const worktreePath = `.worktrees/backport-${base}`; + const worktreePath = `../.worktrees/backport-${base}`; return [ `The backport to \`${base}\` failed:`, "```", @@ -167,7 +167,7 @@ const getFailedBackportCommentBody = ({ "# Create a new working tree", `git worktree add ${worktreePath} ${base}`, "# Navigate to the new working tree", - `cd ${worktreePath}`, + `pushd ${worktreePath}`, "# Create a new branch", `git switch --create ${head}`, "# Cherry-pick the merged commit of this pull request and resolve the conflicts", @@ -175,7 +175,7 @@ const getFailedBackportCommentBody = ({ "# Push it to GitHub", `git push --set-upstream origin ${head}`, "# Go back to the original working tree", - "cd ../..", + "popd", "# Delete the working tree", `git worktree remove ${worktreePath}`, "```",