From 3c1b3f01465a74f7e0617c1d6f06a1f0bf684c90 Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Fri, 16 Nov 2007 11:31:08 -0800 Subject: added update-ref --- lib/git/base.rb | 6 ++++++ lib/git/branch.rb | 4 ++++ lib/git/lib.rb | 5 +++++ 3 files changed, 15 insertions(+) (limited to 'lib/git') diff --git a/lib/git/base.rb b/lib/git/base.rb index 6372beb..4c5cdf5 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -6,6 +6,8 @@ module Git @repository = nil @index = nil + @lib = nil + # opens a bare Git Repository - no working directory options def self.bare(git_dir) self.new :repository => git_dir @@ -376,6 +378,10 @@ module Git commit_tree(tree, opts) end + def update_ref(branch, commit) + branch(branch).update_ref(commit) + end + def ls_files self.lib.ls_files end diff --git a/lib/git/branch.rb b/lib/git/branch.rb index f9106ab..c2ce810 100644 --- a/lib/git/branch.rb +++ b/lib/git/branch.rb @@ -75,6 +75,10 @@ module Git end end + def update_ref(commit) + @base.lib.update_ref(@full, commit) + end + def to_a [@full] end diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 690043d..7742702 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -376,6 +376,11 @@ module Git command('commit-tree', arr_opts) end + def update_ref(branch, commit) + command('update-ref', [branch.to_s, commit.to_s]) + end + + # creates an archive file # # options -- cgit