summaryrefslogtreecommitdiff
path: root/checkout.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2015-03-11 17:05:16 +0100
committerCarlos Martín Nieto <[email protected]>2015-03-11 17:05:16 +0100
commitd300110b8582cd44511efc26a7a0ce04d409f8ce (patch)
tree58652052be2848d110ff3c894517452577f44a95 /checkout.go
parent755721e68453c5d6de0681789dbe3307744fc9c4 (diff)
parent9eae50f29a69fa47cecf3cf4dfb032414cf27a50 (diff)
Merge pull request #178 from schani/master
Fixes and improvements
Diffstat (limited to 'checkout.go')
-rw-r--r--checkout.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/checkout.go b/checkout.go
index 06d010c..6eb6098 100644
--- a/checkout.go
+++ b/checkout.go
@@ -20,10 +20,10 @@ const (
CheckoutAllowConflicts CheckoutStrategy = C.GIT_CHECKOUT_ALLOW_CONFLICTS // Allow checkout to make safe updates even if conflicts are found
CheckoutRemoveUntracked CheckoutStrategy = C.GIT_CHECKOUT_REMOVE_UNTRACKED // Remove untracked files not in index (that are not ignored)
CheckoutRemoveIgnored CheckoutStrategy = C.GIT_CHECKOUT_REMOVE_IGNORED // Remove ignored files not in index
- CheckotUpdateOnly CheckoutStrategy = C.GIT_CHECKOUT_UPDATE_ONLY // Only update existing files, don't create new ones
+ CheckoutUpdateOnly CheckoutStrategy = C.GIT_CHECKOUT_UPDATE_ONLY // Only update existing files, don't create new ones
CheckoutDontUpdateIndex CheckoutStrategy = C.GIT_CHECKOUT_DONT_UPDATE_INDEX // Normally checkout updates index entries as it goes; this stops that
CheckoutNoRefresh CheckoutStrategy = C.GIT_CHECKOUT_NO_REFRESH // Don't refresh index/config/etc before doing checkout
- CheckooutDisablePathspecMatch CheckoutStrategy = C.GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH // Treat pathspec as simple list of exact match file paths
+ CheckoutDisablePathspecMatch CheckoutStrategy = C.GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH // Treat pathspec as simple list of exact match file paths
CheckoutSkipUnmerged CheckoutStrategy = C.GIT_CHECKOUT_SKIP_UNMERGED // Allow checkout to skip unmerged files (NOT IMPLEMENTED)
CheckoutUserOurs CheckoutStrategy = C.GIT_CHECKOUT_USE_OURS // For unmerged files, checkout stage 2 from index (NOT IMPLEMENTED)
CheckoutUseTheirs CheckoutStrategy = C.GIT_CHECKOUT_USE_THEIRS // For unmerged files, checkout stage 3 from index (NOT IMPLEMENTED)
@@ -40,6 +40,19 @@ type CheckoutOpts struct {
TargetDirectory string // Alternative checkout path to workdir
}
+func checkoutOptionsFromC(c *C.git_checkout_options) CheckoutOpts {
+ opts := CheckoutOpts{}
+ opts.Strategy = CheckoutStrategy(c.checkout_strategy)
+ opts.DisableFilters = c.disable_filters != 0
+ opts.DirMode = os.FileMode(c.dir_mode)
+ opts.FileMode = os.FileMode(c.file_mode)
+ opts.FileOpenFlags = int(c.file_open_flags)
+ if c.target_directory != nil {
+ opts.TargetDirectory = C.GoString(c.target_directory)
+ }
+ return opts
+}
+
func (opts *CheckoutOpts) toC() *C.git_checkout_options {
if opts == nil {
return nil