Class: MultiRepo::Branch
- Inherits:
-
Ref
- Object
- Ref
- MultiRepo::Branch
show all
- Defined in:
- lib/multirepo/git/branch.rb
Instance Attribute Summary
Attributes inherited from Ref
#name
Instance Method Summary
collapse
Methods inherited from Ref
#can_fast_forward_to?, #commit_id, #initialize, #merge_commit?, #short_commit_id
Constructor Details
This class inherits a constructor from MultiRepo::Ref
Instance Method Details
#exists? ⇒ Boolean
6
7
8
9
10
|
# File 'lib/multirepo/git/branch.rb', line 6
def exists?
lines = GitRunner.run(@repo.path, "branch", Verbosity::OUTPUT_NEVER).split("\n")
branch_names = lines.map { |line| line.tr("* ", "") }
branch_names.include?(@name)
end
|
#upstream_branch ⇒ Object
12
13
14
15
16
17
|
# File 'lib/multirepo/git/branch.rb', line 12
def upstream_branch
output = GitRunner.run(@repo.path, "config --get branch.#{@name}.merge", Verbosity::OUTPUT_NEVER)
output.sub!("refs/heads/", "")
return nil if output == ""
Branch.new(@repo, "origin/#{output}")
end
|