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
292 293 294 |
# File 'lib/hub/context.rb', line 292 def master? short_name == 'master' end |
#remote? ⇒ Boolean
302 303 304 |
# File 'lib/hub/context.rb', line 302 def remote? name.index('refs/remotes/') == 0 end |
#remote_name ⇒ Object
306 307 308 309 |
# File 'lib/hub/context.rb', line 306 def remote_name name =~ %r{^refs/remotes/([^/]+)} and $1 or raise Error, "can't get remote name from #{name.inspect}" end |
#short_name ⇒ Object
288 289 290 |
# File 'lib/hub/context.rb', line 288 def short_name name.sub(%r{^refs/(remotes/)?.+?/}, '') end |
#upstream ⇒ Object
296 297 298 299 300 |
# File 'lib/hub/context.rb', line 296 def upstream if branch = local_repo.git_command("rev-parse --symbolic-full-name #{short_name}@{upstream}") Branch.new local_repo, branch end end |