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

checkoutbranch forcebranch option not implemented #105

Closed
driusan opened this issue Aug 15, 2018 · 5 comments
Closed

checkoutbranch forcebranch option not implemented #105

driusan opened this issue Aug 15, 2018 · 5 comments
Labels
beginner friendly enhancement hacktoberfest a beginner friendly issue for anyone trying to get a free t-shirt

Comments

@driusan
Copy link
Owner

driusan commented Aug 15, 2018

In git.CheckoutBranch, the branch option (-b) is implemented but forcebranch (-B) isn't.

Implementing it should just be a matter of checking if the refspec exists before creating the branch, and erroring out if ForceBranch isn't set, but calling UpdateRef if it is.

@sirnewton01
Copy link
Collaborator

@driusan do you think that this might get us closer to finishing #113?

@driusan
Copy link
Owner Author

driusan commented Aug 29, 2018

Looks like it would help a little, but not make a huge difference:

$ git grep -e "git checkout -B" t*.sh | cut -f 1 -d ':' | uniq
t0090-cache-tree.sh
t1408-packed-refs.sh
t1430-bad-ref-name.sh
t2018-checkout-branch.sh
t2024-checkout-dwim.sh
t3033-merge-toplevel.sh
t3412-rebase-root.sh
t4038-diff-combined.sh
t4061-diff-indent.sh
t6010-merge-base.sh
t7505-prepare-commit-msg-hook.sh
t7517-per-repo-email.sh
t7800-difftool.sh

(there's only 2 in t2018 and a bunch inf t2024, but t2024 says it's tests for "checking out unborn branches" which isn't really a huge priority..)

@driusan driusan added the hacktoberfest a beginner friendly issue for anyone trying to get a free t-shirt label Oct 13, 2018
@sirnewton01
Copy link
Collaborator

It seems that the -B (force branch) option was already working. I have a PR open to add in some checkout branch tests: #193

@sirnewton01
Copy link
Collaborator

Unless there is any objection I'm going to close this one as done.

@driusan
Copy link
Owner Author

driusan commented Feb 27, 2019

Seems like it's working to me too:

➜  dgit git:(master) ✗ ./dgit checkout -b adsf
➜  dgit git:(adsf) ✗ ./dgit checkout -B adsf
➜  dgit git:(adsf) ✗ ./dgit checkout -b adsf
Branch adsf already exists.
➜  dgit git:(adsf) ✗ ./dgit checkout -b adsf23
➜  dgit git:(adsf23) ✗                          

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner friendly enhancement hacktoberfest a beginner friendly issue for anyone trying to get a free t-shirt
Projects
None yet
Development

No branches or pull requests

2 participants