lib/atlassian/stash/git.rb in atlassian-stash-0.4.1 vs lib/atlassian/stash/git.rb in atlassian-stash-0.5.0
- old
+ new
@@ -9,11 +9,11 @@
def get_current_branch
%x(git symbolic-ref HEAD)[/refs\/heads\/(.*)/, 1]
end
def get_branches()
- all = %x{git branch -a}.gsub("*","").gsub(" ", "").split("\n")
+ all = %x{git branch --no-color -a}.gsub("*","").gsub(" ", "").split("\n")
all.select{|x| not x.include? "->"}
end
def is_branch?(match)
all = get_branches
@@ -24,9 +24,15 @@
system('git rev-parse')
end
def get_remotes
%x(git remote -v)
+ end
+
+ def get_remote(branch = nil)
+ remote_branch = %x(git rev-parse --abbrev-ref --symbolic-full-name #{branch}@{u} 2>/dev/null)
+ remote = remote_branch.split('/').first
+ remote == "" ? nil : remote
end
def get_remote_url(remote=nil)
remotes = get_remotes
return nil if remotes.empty?