-
Notifications
You must be signed in to change notification settings - Fork 534
Conversation
options.go
Outdated
@@ -194,20 +194,35 @@ type SubmoduleUpdateOptions struct { | |||
RecurseSubmodules SubmoduleRescursivity | |||
} | |||
|
|||
var ( | |||
ErrBranchHashExclusive = errors.New("Branch and Hash are mutual exclusive") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mutual exclusive -> mutually exclusive
options.go
Outdated
// CheckoutOptions describes how a checkout 31operation should be performed. | ||
type CheckoutOptions struct { | ||
// Hash to be checked out, if used HEAD will in detached mode. Branch and | ||
// Hash are mutual exclusive. | ||
// Hash are mutual exclusive, if Create is not used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mutual exclusive -> mutually exclusive
@@ -71,6 +77,29 @@ func (w *Worktree) Checkout(opts *CheckoutOptions) error { | |||
|
|||
return w.Reset(ro) | |||
} | |||
func (w *Worktree) createBranch(opts *CheckoutOptions) error { | |||
_, err := w.r.Storer.Reference(opts.Branch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the checking existence of and creation of the reference all delegates through w.r
, does it make sense to push the API for creating and updating branches into Repository
instead? Especially considering that the standard git branch
tool allows the creation and management of branches within bare repositories (and bare go-git
repositories have nil
Worktrees)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, maybe make sense having Repository.CreateBranch
let me thing about it.
Codecov Report
@@ Coverage Diff @@
## master #487 +/- ##
==========================================
- Coverage 78.12% 77.49% -0.64%
==========================================
Files 127 127
Lines 9313 9334 +21
==========================================
- Hits 7276 7233 -43
- Misses 1241 1317 +76
+ Partials 796 784 -12
Continue to review full report at Codecov.
|
This PR adds the options of create a branch when a Checkout is perform.
Fixes #481