aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-04-12 03:46:28 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-04-12 03:46:28 +0200
commit63f234847bf613b621b3a714d77fc077d88717e6 (patch)
tree610c99bb6fe6c9cbc7b8666652352321726212ee /options.go
parente14ee7a2645b486d72f52a0c62714b3049077554 (diff)
downloadgo-git-63f234847bf613b621b3a714d77fc077d88717e6.tar.gz
worktree, reset implementation and status improvements
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
}