diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-04-12 03:46:28 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-04-12 03:46:28 +0200 |
commit | 63f234847bf613b621b3a714d77fc077d88717e6 (patch) | |
tree | 610c99bb6fe6c9cbc7b8666652352321726212ee /options.go | |
parent | e14ee7a2645b486d72f52a0c62714b3049077554 (diff) | |
download | go-git-63f234847bf613b621b3a714d77fc077d88717e6.tar.gz |
worktree, reset implementation and status improvements
Diffstat (limited to 'options.go')
-rw-r--r-- | options.go | 28 |
1 files changed, 21 insertions, 7 deletions
@@ -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 } |