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

Update git-delete-branch #577

Closed
wants to merge 1 commit into from

Conversation

bturrubiates
Copy link

Instead of assuming 'origin' as the remote, default to using the remote
tracking configuration. This can be overridden by using the -r option to
provide a remote name and a remote branch name. This also removes the ability
to delete multiple branches at once.

Closes #514.

@hemanth, apologies this took so long. I haven't updated the completions file yet,
need to figure that out.

Thoughts?

Instead of assuming 'origin' as the remote, default to using the remote
tracking configuration. This can be overridden by using the -r option to
provide a remote name and a remote branch name. This also removes the ability
to delete multiple branches at once.

Closes tj#514.
@hemanth
Copy link
Collaborator

hemanth commented Sep 12, 2016

LGTM

@spacewander ^

case "$opt" in
r)
remote="$(echo ${OPTARG} | cut -d ':' -f 1)"
remote_branch="$(echo ${OPTARG} | cut -s -d ':' -f 2)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to use parameter expansion instead.

Copy link
Author

Choose a reason for hiding this comment

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

Better to use parameter expansion instead.

Hmm I thought using cut would be more clear. So is this what you're suggestion:

So instead of:

remote="$(echo ${OPTARG} | cut -d ':' -f 1)"
remote_branch="$(echo ${OPTARG} | cut -s -d ':' -f 2)"

you want:

remote=${OPTARG%%:*}
remote_branch=${OPTARG##*:}

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.

None yet

3 participants