summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.(none)>2007-11-11 11:37:51 -0800
committerscott Chacon <schacon@agadorsparticus.(none)>2007-11-11 11:37:51 -0800
commit3cb57d82c301e9b8a16f30f468401e3007845bb7 (patch)
treebca0369a2d0290694b028aee5b5368281cd90b9f
parent070381bb456b25f3e867e9b23b78911190c6b369 (diff)
downloadthird_party-ruby-git-3cb57d82c301e9b8a16f30f468401e3007845bb7.tar.gz
third_party-ruby-git-3cb57d82c301e9b8a16f30f468401e3007845bb7.tar.xz
third_party-ruby-git-3cb57d82c301e9b8a16f30f468401e3007845bb7.zip
changed .commit to .gcommit for consistency
-rw-r--r--EXAMPLES4
-rw-r--r--lib/git/branch.rb9
-rw-r--r--tests/units/test_branch.rb2
3 files changed, 10 insertions, 5 deletions
diff --git a/EXAMPLES b/EXAMPLES
index 22aab6c..9d05965 100644
--- a/EXAMPLES
+++ b/EXAMPLES
@@ -31,8 +31,8 @@ g.revparse('v2.5:Makefile')
g.branches # returns Git::Branch objects
g.branches.local
g.branches.remote
-g.branches[:master].commit
-g.branches['origin/master'].commit
+g.branches[:master].gcommit
+g.branches['origin/master'].gcommit
g.grep('hello') # implies HEAD
g.blob('v2.5:Makefile').grep('hello')
diff --git a/lib/git/branch.rb b/lib/git/branch.rb
index cc33970..bf4d80a 100644
--- a/lib/git/branch.rb
+++ b/lib/git/branch.rb
@@ -1,15 +1,15 @@
module Git
class Branch < Path
- attr_accessor :full, :remote, :name, :current, :commit
+ attr_accessor :full, :remote, :name, :current
@base = nil
+ @gcommit = nil
def initialize(base, name, current = false)
@remote = nil
@full = name
@base = base
- @commit = @base.object(name)
@current = current
parts = name.split('/')
@@ -21,5 +21,10 @@ module Git
end
end
+ def gcommit
+ @gcommit = @base.object(name) if !@gcommit
+ @gcommit
+ end
+
end
end
diff --git a/tests/units/test_branch.rb b/tests/units/test_branch.rb
index ea242fc..c1fe9d6 100644
--- a/tests/units/test_branch.rb
+++ b/tests/units/test_branch.rb
@@ -43,7 +43,7 @@ class TestBranch < Test::Unit::TestCase
end
def test_branch_commit
- assert_equal(270, @git.branches[:test_branches].commit.size)
+ assert_equal(270, @git.branches[:test_branches].gcommit.size)
end
end \ No newline at end of file