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

rework last step in setup.bash #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,19 @@ EOF

printf "All done.\n"
printf "Your %s branch has been reset to an initial commit.\n" "$primary_branch"
printf "Push to origin/%s with \`git push --force-with-lease\`\n" "$primary_branch"

printf "Review these TODO items:\n"
git grep -P -n -C 3 "TODO"
ok="${9:-$(ask_for "Push to origin? (yes/no)")}"
if [ "yes" != "$ok" ]; then
printf "Local repo not pushed.\n"
printf "Manually push to origin/%s with \`git push --force-with-lease\`\n" "$primary_branch"
printf "Then, find TODO items with \`git grep -n TODO\` and resolve them.\n"

Choose a reason for hiding this comment

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

I do like this approach (git using a pager by default is very annoying) but would -C 3 still be useful here for a bit of context? No idea why -P was ever the case though :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should omit the context lines because:

  • the TODO items are mostly independent of each other
  • to resolve the TODO items, the developer would have to open the file(s) anyway
  • having the line numbers is enough for the developer to open a file and quickly jump to that line, and then get the context
  • adding 3+3 lines of context (+ 1 line for separator) fills up the screen pretty quickly, and this makes it more difficult to see all the TODO items as a list

printf "Remember to commit and push your changes afterwards.\n"
else
git push --force-with-lease
printf "Done pushing to origin/%s\n" "$primary_branch"
printf "Now, find TODO items with \`git grep -n TODO\` and resolve them.\n"
printf "Remember to commit and push your changes afterwards.\n"
fi
) || cd "$cwd"
fi
}
Expand Down Expand Up @@ -287,10 +296,19 @@ EOF

printf "All done.\n"
printf "Your %s branch has been reset to an initial commit.\n" "$primary_branch"
printf "You might want to push using \`--force-with-lease\` to origin/%s\n" "$primary_branch"

printf "Showing pending TODO tags that you might want to review\n"
git grep -P -n -C 3 "TODO"
ok="${9:-$(ask_for "Push to origin? (yes/no)")}"
if [ "yes" != "$ok" ]; then
printf "Local repo not pushed.\n"
printf "Manually push to origin/%s with \`git push --force-with-lease\`\n" "$primary_branch"
printf "Then, find TODO items with \`git grep -n TODO\` and resolve them.\n"
printf "Remember to commit and push your changes afterwards.\n"
else
git push --force-with-lease
printf "Done pushing to origin/%s\n" "$primary_branch"
printf "Now, find TODO items with \`git grep -n TODO\` and resolve them.\n"
printf "Remember to commit and push your changes afterwards.\n"
fi
) || cd "$cwd"
fi
}
Expand Down