Method: Git::Lib#current_branch_state

Defined in:
lib/git/lib.rb

#current_branch_stateHeadState

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The current branch state which is the state of HEAD

Returns:

  • (HeadState)

    the state and name of the current branch



786
787
788
789
790
791
792
# File 'lib/git/lib.rb', line 786

def current_branch_state
  branch_name = command('branch', '--show-current')
  return HeadState.new(:detached, 'HEAD') if branch_name.empty?

  state = get_branch_state(branch_name)
  HeadState.new(state, branch_name)
end