Class: EacGit::Local::Branch
- Inherits:
-
Object
- Object
- EacGit::Local::Branch
- Defined in:
- lib/eac_git/local/branch.rb
Constant Summary collapse
- REFS_PREFIX =
'refs/heads/'
Instance Method Summary collapse
-
#current_commit_id ⇒ String
deprecated
Deprecated.
Use #head_commit_id instead.
- #exist? ⇒ Boolean
- #full_ref_name ⇒ Object
- #head_commit ⇒ EacGit::Local::Commit
- #head_commit_id ⇒ String
- #push(remote, options = {}) ⇒ void
Instance Method Details
#current_commit_id ⇒ String
Deprecated.
Use #head_commit_id instead.
14 15 16 |
# File 'lib/eac_git/local/branch.rb', line 14 def current_commit_id head_commit_id end |
#exist? ⇒ Boolean
19 20 21 |
# File 'lib/eac_git/local/branch.rb', line 19 def exist? local.command('show-ref', '--quiet', full_ref_name).execute.fetch(:exit_code).zero? end |
#full_ref_name ⇒ Object
23 24 25 |
# File 'lib/eac_git/local/branch.rb', line 23 def full_ref_name "#{REFS_PREFIX}#{name}" end |
#head_commit ⇒ EacGit::Local::Commit
28 29 30 |
# File 'lib/eac_git/local/branch.rb', line 28 def head_commit local.commit(head_commit_id, true) end |
#head_commit_id ⇒ String
33 34 35 |
# File 'lib/eac_git/local/branch.rb', line 33 def head_commit_id local.rev_parse(full_ref_name, true) end |
#push(remote, options = {}) ⇒ void
This method returns an undefined value.
39 40 41 42 43 44 |
# File 'lib/eac_git/local/branch.rb', line 39 def push(remote, = {}) [:refspec] = name .inject(remote.push) do |a, e| a.send(*e) end.perform end |