Module: Avm::Git::Issue::Complete::LocalBranch
- Defined in:
- lib/avm/git/issue/complete/local_branch.rb
Instance Method Summary collapse
- #branch_hash_result ⇒ Object
- #branch_hash_uncached ⇒ Object
- #branch_name ⇒ Object
- #branch_name_result ⇒ Object
- #branch_uncached ⇒ Object
- #follow_master? ⇒ Boolean
- #follow_master_result ⇒ Object
- #remove_local_branch ⇒ Object
Instance Method Details
#branch_hash_result ⇒ Object
26 27 28 29 30 31 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 26 def branch_hash_result ::Avm::Result.success_or_error( branch_hash.present?, branch_hash ) end |
#branch_hash_uncached ⇒ Object
14 15 16 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 14 def branch_hash_uncached @git.rev_parse("refs/heads/#{branch}") end |
#branch_name ⇒ Object
18 19 20 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 18 def branch_name branch.split('/')[-1] end |
#branch_name_result ⇒ Object
22 23 24 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 22 def branch_name_result ::Avm::Result.success_or_error(issue_id.present?, branch_name) end |
#branch_uncached ⇒ Object
10 11 12 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 10 def branch_uncached @git.current_branch end |
#follow_master? ⇒ Boolean
40 41 42 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 40 def follow_master? remote_master_hash ? @git.descendant?(branch_hash, remote_master_hash) : true end |
#follow_master_result ⇒ Object
33 34 35 36 37 38 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 33 def follow_master_result return ::Avm::Result.neutral('No branch hash') unless branch_hash r = follow_master? ::Avm::Result.success_or_error(r, 'yes', 'no') end |
#remove_local_branch ⇒ Object
44 45 46 47 48 49 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 44 def remove_local_branch info 'Removendo branch local...' bn = branch_name git(['checkout', branch_hash]) git(['branch', '-D', bn]) end |