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.
12 13 14 |
# File 'lib/eac_git/local/branch.rb', line 12 def current_commit_id head_commit_id end |
#exist? ⇒ Boolean
17 18 19 |
# File 'lib/eac_git/local/branch.rb', line 17 def exist? local.command('show-ref', '--quiet', full_ref_name).execute.fetch(:exit_code).zero? end |
#full_ref_name ⇒ Object
21 22 23 |
# File 'lib/eac_git/local/branch.rb', line 21 def full_ref_name "#{REFS_PREFIX}#{name}" end |
#head_commit ⇒ EacGit::Local::Commit
26 27 28 |
# File 'lib/eac_git/local/branch.rb', line 26 def head_commit local.commit(head_commit_id, true) end |
#head_commit_id ⇒ String
31 32 33 |
# File 'lib/eac_git/local/branch.rb', line 31 def head_commit_id local.rev_parse(full_ref_name, true) end |
#push(remote, options = {}) ⇒ void
This method returns an undefined value.
37 38 39 40 41 42 |
# File 'lib/eac_git/local/branch.rb', line 37 def push(remote, = {}) [:refspec] = name .inject(remote.push) do |a, e| a.send(*e) end.perform end |