aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
diff options
context:
space:
mode:
Diffstat (limited to 'options.go')
-rw-r--r--options.go28
1 files changed, 21 insertions, 7 deletions
diff --git a/options.go b/options.go
index f46bb6d..50fba10 100644
--- a/options.go
+++ b/options.go
@@ -178,12 +178,15 @@ type SubmoduleUpdateOptions struct {
RecurseSubmodules SubmoduleRescursivity
}
-// CheckoutOptions describes how a checkout operation should be performed.
+// CheckoutOptions describes how a checkout 31operation should be performed.
type CheckoutOptions struct {
- // Branch to be checked out, if empty uses `master`
+ // Hash to be checked out, if used HEAD will in detached mode. Branch and
+ // Hash are mutual exclusive.
+ Hash plumbing.Hash
+ // Branch to be checked out, if Branch and Hash are empty is set to `master`.
Branch plumbing.ReferenceName
- Hash plumbing.Hash
- // RemoteName is the name of the remote to be pushed to.
+ // Force, if true when switching branches, proceed even if the index or the
+ // working tree differs from HEAD. This is used to throw away local changes
Force bool
}
@@ -196,23 +199,34 @@ func (o *CheckoutOptions) Validate() error {
return nil
}
-type ResetMode int
+// ResetMode defines the mode of a reset operation.
+type ResetMode int8
const (
// HardReset resets the index and working tree. Any changes to tracked files
// in the working tree are discarded.
HardReset ResetMode = iota
- // MixedReset Resets the index but not the working tree (i.e., the changed
+ // MixedReset resets the index but not the working tree (i.e., the changed
// files are preserved but not marked for commit) and reports what has not
// been updated. This is the default action.
MixedReset
+ // MergeReset resets the index and updates the files in the working tree
+ // that are different between Commit and HEAD, but keeps those which are
+ // different between the index and working tree (i.e. which have changes
+ // which have not been added).
+ //
+ // If a file that is different between Commit and the index has unstaged
+ // changes, reset is aborted.
+ MergeReset
)
// ResetOptions describes how a reset operation should be performed.
type ResetOptions struct {
// Commit, if commit is pressent set the current branch head (HEAD) to it.
Commit plumbing.Hash
- // Mode
+ // Mode, form resets the current branch head to Commit and possibly updates
+ // the index (resetting it to the tree of Commit) and the working tree
+ // depending on Mode. If empty MixedReset is used.
Mode ResetMode
}