Skip to content

Commit 3cb57d8

Browse files
author
scott Chacon
committed
changed .commit to .gcommit for consistency
1 parent 070381b commit 3cb57d8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

EXAMPLES

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ g.revparse('v2.5:Makefile')
3131
g.branches # returns Git::Branch objects
3232
g.branches.local
3333
g.branches.remote
34-
g.branches[:master].commit
35-
g.branches['origin/master'].commit
34+
g.branches[:master].gcommit
35+
g.branches['origin/master'].gcommit
3636

3737
g.grep('hello') # implies HEAD
3838
g.blob('v2.5:Makefile').grep('hello')

lib/git/branch.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module Git
22
class Branch < Path
33

4-
attr_accessor :full, :remote, :name, :current, :commit
4+
attr_accessor :full, :remote, :name, :current
55

66
@base = nil
7+
@gcommit = nil
78

89
def initialize(base, name, current = false)
910
@remote = nil
1011
@full = name
1112
@base = base
12-
@commit = @base.object(name)
1313
@current = current
1414

1515
parts = name.split('/')
@@ -21,5 +21,10 @@ def initialize(base, name, current = false)
2121
end
2222
end
2323

24+
def gcommit
25+
@gcommit = @base.object(name) if !@gcommit
26+
@gcommit
27+
end
28+
2429
end
2530
end

tests/units/test_branch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_branches_single
4343
end
4444

4545
def test_branch_commit
46-
assert_equal(270, @git.branches[:test_branches].commit.size)
46+
assert_equal(270, @git.branches[:test_branches].gcommit.size)
4747
end
4848

4949
end

0 commit comments

Comments
 (0)