summaryrefslogtreecommitdiffstats
path: root/lib/git
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/base.rb5
-rw-r--r--lib/git/lib.rb8
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/git/base.rb b/lib/git/base.rb
index 4c5cdf5..2986864 100644
--- a/lib/git/base.rb
+++ b/lib/git/base.rb
@@ -361,6 +361,10 @@ module Git
with_index(temp_path, &blk)
end
+ def checkout_index(opts = {})
+ self.lib.checkout_index(opts)
+ end
+
def read_tree(treeish, opts = {})
self.lib.read_tree(treeish, opts)
end
@@ -382,6 +386,7 @@ module Git
branch(branch).update_ref(commit)
end
+
def ls_files
self.lib.ls_files
end
diff --git a/lib/git/lib.rb b/lib/git/lib.rb
index 7742702..dbd3d69 100644
--- a/lib/git/lib.rb
+++ b/lib/git/lib.rb
@@ -380,6 +380,14 @@ module Git
command('update-ref', [branch.to_s, commit.to_s])
end
+ def checkout_index(opts = {})
+ arr_opts = []
+ arr_opts << "--prefix=#{opts[:prefix]}" if opts[:prefix]
+ arr_opts << "--force" if opts[:force]
+ arr_opts << "--all" if opts[:all]
+ arr_opts << ('-- ' + opts[:path_limiter]) if opts[:path_limiter].is_a? String
+ command('checkout-index', arr_opts)
+ end
# creates an archive file
#