From 10b880b418879e662feb91ce7af98560adeaa8bb Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Thu, 13 Mar 2008 13:33:49 -0700 Subject: added patch from Cassie Schmitz for file checkout --- lib/git/base.rb | 5 +++++ lib/git/lib.rb | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/git/base.rb b/lib/git/base.rb index 2201eb5..a670fd8 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -277,6 +277,11 @@ module Git self.lib.checkout(branch, opts) end + # checks out an old version of a file + def checkout_file(version, file) + self.lib.checkout_file(version,file) + end + # fetches changes from a remote branch - this does not modify the working directory, # it just gets the changes from the remote if there are any def fetch(remote = 'origin') diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 8003336..71f960a 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -434,6 +434,13 @@ module Git command('checkout', arr_opts) end + + def checkout_file(version, file) + arr_opts = [] + arr_opts << version.to_s + arr_opts << file.to_s + command('checkout', arr_opts) + end def merge(branch, message = nil) arr_opts = [] -- cgit