Module: Gotsha::RemoteResolver

Defined in:
lib/gotsha/remote_resolver.rb

Class Method Summary collapse

Class Method Details

.resolveObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gotsha/remote_resolver.rb', line 7

def self.resolve
  branch_name = BashCommand.run!("git branch --show-current").text_output
  return "origin" if branch_name.empty?

  push_remote = git_config("branch.#{branch_name}.pushRemote")
  return push_remote unless push_remote.empty?

  branch_remote = git_config("branch.#{branch_name}.remote")
  return branch_remote unless branch_remote.empty?

  "origin"
end