diff options
author | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-11 12:21:30 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-11 12:21:30 -0800 |
commit | abcb1453e210beb6de70a69d3501cf842b38636e (patch) | |
tree | 0612905ab3ec279694d2780b43274cb332757d1a /lib/git/lib.rb | |
parent | 3cb57d82c301e9b8a16f30f468401e3007845bb7 (diff) | |
download | third_party-ruby-git-abcb1453e210beb6de70a69d3501cf842b38636e.tar.gz third_party-ruby-git-abcb1453e210beb6de70a69d3501cf842b38636e.tar.xz third_party-ruby-git-abcb1453e210beb6de70a69d3501cf842b38636e.zip |
added branch and checkout functionality
Diffstat (limited to 'lib/git/lib.rb')
-rw-r--r-- | lib/git/lib.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/git/lib.rb b/lib/git/lib.rb index bc40e0c..41b3efb 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -93,6 +93,11 @@ module Git arr end + def branch_current + branches_all.select { |b| b[1] }.first[0] rescue nil + end + + # returns hash # [tree-ish] = [[line_no, match], [line_no, match2]] # [tree-ish] = [[line_no, match], [line_no, match2]] @@ -235,6 +240,22 @@ module Git command('reset', arr_opts) end + + def branch_new(branch) + command('branch', branch) + end + + def branch_delete(branch) + command('branch', ['-d', branch]) + end + + def checkout(branch, opts = {}) + arr_opts = [] + arr_opts << '-f' if opts[:force] + arr_opts << branch.to_s + + command('checkout', arr_opts) + end private |