Module: BranchDb::GitUtils
- Included in:
- Naming
- Defined in:
- lib/branch_db/git_utils.rb
Instance Method Summary collapse
- #current_branch ⇒ Object
- #git_branches ⇒ Object
- #parent_branch ⇒ Object
- #reset_parent_cache! ⇒ Object
Instance Method Details
#current_branch ⇒ Object
3 4 5 6 7 8 |
# File 'lib/branch_db/git_utils.rb', line 3 def current_branch override = ENV.fetch("BRANCH_DB_BRANCH", nil) return override if override && !override.empty? `git symbolic-ref HEAD 2>/dev/null`.chomp.sub("refs/heads/", "") end |
#git_branches ⇒ Object
10 11 12 13 |
# File 'lib/branch_db/git_utils.rb', line 10 def git_branches output = `git branch --format='%(refname:short)' 2>/dev/null` output.split("\n").map(&:strip).reject(&:empty?) end |
#parent_branch ⇒ Object
15 |
# File 'lib/branch_db/git_utils.rb', line 15 def parent_branch = @parent_branch ||= detect_parent_branch |
#reset_parent_cache! ⇒ Object
17 |
# File 'lib/branch_db/git_utils.rb', line 17 def reset_parent_cache! = @parent_branch = nil |