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
29 30 31 32 33 34 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 29 def branch_hash_result ::Avm::Result.success_or_error( branch_hash.present?, branch_hash ) end |
#branch_hash_uncached ⇒ Object
17 18 19 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 17 def branch_hash_uncached branch.if_present(&:current_commit_id) end |
#branch_name ⇒ Object
21 22 23 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 21 def branch_name branch.if_present(NO_CURRENT_BRANCH_NAME, &:name) end |
#branch_name_result ⇒ Object
25 26 27 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 25 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.
13 14 15 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 13 def branch_uncached eac_git.current_branch end |
#follow_master? ⇒ Boolean
43 44 45 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 43 def follow_master? remote_master_hash ? launcher_git.descendant?(branch_hash, remote_master_hash) : true end |
#follow_master_result ⇒ Object
36 37 38 39 40 41 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 36 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
47 48 49 50 51 52 53 54 |
# File 'lib/avm/git/issue/complete/local_branch.rb', line 47 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 |