summaryrefslogtreecommitdiffstats
path: root/lib/git/branch.rb
blob: bf4d80a47c46b9c7641d405bc1ac1ff9688ac513 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Git
  class Branch < Path
    
    attr_accessor :full, :remote, :name, :current
    
    @base = nil
    @gcommit = nil
    
    def initialize(base, name, current = false)
      @remote = nil
      @full = name
      @base = base
      @current = current
      
      parts = name.split('/')
      if parts[1]
        @remote = Git::Remote.new(@base, parts[0])
        @name = parts[1]
      else
        @name = parts[0]
      end
    end
    
    def gcommit
      @gcommit = @base.object(name) if !@gcommit
      @gcommit
    end
    
  end
end