Class: Hub::Context::Branch
- Inherits:
-
Struct
- Object
- Struct
- Hub::Context::Branch
- Defined in:
- lib/hub/context.rb
Instance Method Summary collapse
Instance Method Details
#master? ⇒ Boolean
307 308 309 |
# File 'lib/hub/context.rb', line 307 def master? short_name == 'master' end |
#remote? ⇒ Boolean
317 318 319 |
# File 'lib/hub/context.rb', line 317 def remote? name.index('refs/remotes/') == 0 end |
#remote_name ⇒ Object
321 322 323 324 |
# File 'lib/hub/context.rb', line 321 def remote_name name =~ %r{^refs/remotes/([^/]+)} and $1 or raise Error, "can't get remote name from #{name.inspect}" end |
#short_name ⇒ Object
303 304 305 |
# File 'lib/hub/context.rb', line 303 def short_name name.sub(%r{^refs/(remotes/)?.+?/}, '') end |
#upstream ⇒ Object
311 312 313 314 315 |
# File 'lib/hub/context.rb', line 311 def upstream if branch = local_repo.git_command("rev-parse --symbolic-full-name #{short_name}@{upstream}") Branch.new local_repo, branch end end |