lib/atlassian/stash/git.rb in atlassian-stash-0.1.5 vs lib/atlassian/stash/git.rb in atlassian-stash-0.1.6
- old
+ new
@@ -9,11 +9,16 @@
def is_in_git_repository?
system('git rev-parse')
end
+ def get_remotes
+ %x(git remote -v)
+ end
+
def get_remote_url
- URI.extract(%x(git remote -v)).first
+ origin = get_remotes.split("\n").collect { |r| r.strip }.grep(/^origin.*\(push\)$/).first
+ URI.extract(origin).first
end
def ensure_within_git!
if is_in_git_repository?
yield