Skip to content

Commit

Permalink
Merge pull request #2 from waynemoore/ruby-1.9-fix
Browse files Browse the repository at this point in the history
Ruby 1.9 fix
  • Loading branch information
pcreux committed Jun 4, 2012
2 parents 690301c + e2a2267 commit f2d8028
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bin/git-branch-delete-orphans
Expand Up @@ -2,15 +2,21 @@

def remotes
puts "Listing remote branches..."
@remote ||= `git ls-remote | grep 'refs/heads'`.map { |l| l.gsub(/^.*refs\/heads\//, '').strip }
@remote ||= `git ls-remote | grep 'refs/heads'`.split("\n").map { |l| l.gsub(/^.*refs\/heads\//, '').strip }
end

def locals
@local ||= `cat .git/config | grep "refs/heads/\\w"`.map { |l| l.gsub(/^.*refs\/heads\//, '').strip }
@local ||= `cat .git/config | grep "refs/heads/\\w"`.split("\n").map { |l| l.gsub(/^.*refs\/heads\//, '').strip }
end

def cli(orphans)
puts ""

if orphans.empty?
puts "No orphaned local branches, nothing to do."
exit
end

puts "The following branches track a remote branch which does not exist anymore:"
orphans.each { |b| puts " - #{b}" }

Expand Down

0 comments on commit f2d8028

Please sign in to comment.