Skip to content
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

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

andrross
Copy link

@andrross andrross commented Nov 1, 2022

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

  • Commits are signed per the DCO using --signoff

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.

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)",

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)

Copy link
Author

@andrross andrross Nov 2, 2022

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}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?)

@VachaShah VachaShah merged commit dc45320 into VachaShah:main Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants