Skip to content

Commit

Permalink
Put worktree outside of repo in manual steps
Browse files Browse the repository at this point in the history
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 <andrross@amazon.com>
  • Loading branch information
andrross committed Oct 26, 2022
1 parent 37be8e1 commit c2d0755
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/backport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:`,
"```",
Expand All @@ -167,15 +167,15 @@ 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",
`git cherry-pick -x --mainline 1 ${commitSha}`,
"# 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}`,
"```",
Expand Down

0 comments on commit c2d0755

Please sign in to comment.