-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add repo name to worktree path #7
Conversation
This addresses two issues: 1) no longer assume that the user is working from the root directory of the repository, and 2) put the repo name in the working tree path to avoid any potential conflicts from backports from other repositories. Signed-off-by: Andrew Ross <andrross@amazon.com>
return [ | ||
`The backport to \`${base}\` failed:`, | ||
"```", | ||
errorMessage, | ||
"```", | ||
"To backport manually, run these commands in your terminal:", | ||
"```bash", | ||
"# Navigate to the root of your repository", | ||
"cd $(git rev-parse --show-toplevel)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
below you switched to pushd
& popd
, but here you use cd
again.
but i think you can just leave the cd
out - because git fetch
and git worktree
work regardless of where you call it as long as you're in the repo. you just need to use an absolute path for the worktree (see comment above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was somewhat intentional because I didn't really want to bury that git rev-parse --show-toplevel
command as a nested command because I assumed most folks wouldn't be familiar with it (you and I both were not). Here with the comment above it is pretty clear what it is doing. I can try out your suggestion though.
}) => { | ||
const worktreePath = `../.worktrees/backport-${base}`; | ||
const worktreePath = `../.worktrees/${repo}/backport-${base}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const worktreePath = `../.worktrees/${repo}/backport-${base}`; | |
const worktreePath = `\$(git rev-parse --show-toplevel)/.worktrees/${repo}/backport-${base}`; |
(i'm not super fluent in typescript, but think that this should then include the actual command in the output?)
3a9c75a
to
a82e65e
Compare
This addresses two issues: 1) no longer assume that the user is working from the root directory of the repository, and 2) put the repo name in the working tree path to avoid any potential conflicts from backports from other repositories.
Signed-off-by: Andrew Ross andrross@amazon.com
This addresses @rursprung's comment
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.