Module: Avm::Git::Issue::Complete::LocalBranch
- Defined in:
- lib/avm/git/issue/complete/local_branch.rb
Constant Summary collapse
- NO_CURRENT_BRANCH_NAME =
'none'
Instance Method Summary collapse
- #branch_hash_result ⇒ Object
- #branch_hash_uncached ⇒ Object
- #branch_name ⇒ Object
- #branch_name_result ⇒ Object
-
#branch_uncached ⇒ EacGit::Local::Branch?
Retrieves the current local branch.
- #follow_master? ⇒ Boolean
- #follow_master_result ⇒ Object
- #remove_local_branch ⇒ Object
Instance Method Details
#branch_hash_result ⇒ Object
31 32 33 34 35 36 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 31 def branch_hash_result ::Avm::Result.success_or_error( branch_hash.present?, branch_hash ) end |
#branch_hash_uncached ⇒ Object
19 20 21 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 19 def branch_hash_uncached branch.if_present(&:current_commit_id) end |
#branch_name ⇒ Object
23 24 25 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 23 def branch_name branch.if_present(NO_CURRENT_BRANCH_NAME, &:name) end |
#branch_name_result ⇒ Object
27 28 29 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 27 def branch_name_result ::Avm::Result.success_or_error(issue_id.present?, branch_name) end |
#branch_uncached ⇒ EacGit::Local::Branch?
Retrieves the current local branch.
15 16 17 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 15 def branch_uncached eac_git.current_branch end |
#follow_master? ⇒ Boolean
45 46 47 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 45 def follow_master? remote_master_hash ? launcher_git.descendant?(branch_hash, remote_master_hash) : true end |
#follow_master_result ⇒ Object
38 39 40 41 42 43 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 38 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
49 50 51 52 53 54 55 56 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 49 def remove_local_branch return unless branch info 'Removendo branch local...' bn = branch_name git_execute(['checkout', branch_hash]) git_execute(['branch', '-D', bn]) end |