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

Adds plugin for git interactive checkout #12244

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

adamsir
Copy link

@adamsir adamsir commented Feb 28, 2024

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.
  • If the code introduces new aliases, I provide a valid use case for all plugin users down below.

Changes:

  • plugin which allows to do a quick switch between git branches

Other comments:

...

@ohmyzsh ohmyzsh bot added Area: plugin Issue or PR related to a plugin Topic: alias Pull Request or issue regarding aliases Type: documentation Documentation issue or Pull Request New: plugin Request for a plugin or Pull Request that adds one labels Feb 28, 2024
Copy link
Contributor

@LunarWatcher LunarWatcher left a comment

Choose a reason for hiding this comment

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

On top of the other comments, it's probably also a good idea to error check the git commands. Outside a git repo, at least two git commands are executed before the function stops:

❯ gci
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

@@ -0,0 +1,15 @@
# lol
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be replaced with a proper title

git checkout "$target_branch"
break
else
break
Copy link
Contributor

Choose a reason for hiding this comment

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

This should arguably return a non-zero code, as it's an error state. Even then, why is this a loop at all? Both branches break, so there's no looping in any scenario

Copy link
Contributor

Choose a reason for hiding this comment

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

If this was supposed to be a continue and not a break, the echo -n on line 39 should be moved into the loop as well

plugins/git-checkout-interactive/README.md Outdated Show resolved Hide resolved
#######################################

function git-checkout-interactive() {
local ITEMS_TO_SHOW=10
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't necessarily need to be changed (it's not a problem, nor something I consider a significant problem), but why have a function-local constant as a variable if it can't be configured in some way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: plugin Issue or PR related to a plugin New: plugin Request for a plugin or Pull Request that adds one Topic: alias Pull Request or issue regarding aliases Type: documentation Documentation issue or Pull Request
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

None yet

2 participants