diff options
Diffstat (limited to 'lib/git/branch.rb')
-rw-r--r-- | lib/git/branch.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/git/branch.rb b/lib/git/branch.rb index 8f8953b..cc33970 100644 --- a/lib/git/branch.rb +++ b/lib/git/branch.rb @@ -1,10 +1,24 @@ module Git class Branch < Path + attr_accessor :full, :remote, :name, :current, :commit + @base = nil - def initialize(base, name) + def initialize(base, name, current = false) + @remote = nil + @full = name @base = base + @commit = @base.object(name) + @current = current + + parts = name.split('/') + if parts[1] + @remote = Git::Remote.new(@base, parts[0]) + @name = parts[1] + else + @name = parts[0] + end end end |