Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ab29fc

Browse files
committed
Clean up the branch listings a bit more.
1 parent aa2ef13 commit 0ab29fc

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/svn2git/migration.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,12 @@ def clone!
150150
end
151151

152152
def get_branches
153-
@local = run_command("git branch -l").split(/\n/).collect{ |b| b.strip }
154-
@remote = run_command("git branch -r").split(/\n/).collect{ |b| b.strip }
153+
# Get the list of local and remote branches, taking care to ignore console color codes and ignoring the
154+
# '*' character used to indicate the currently selected branch.
155+
@local = run_command("git branch -l --no-color").split(/\n/).collect{ |b| b.gsub(/\*/,'').strip }
156+
@remote = run_command("git branch -r --no-color").split(/\n/).collect{ |b| b.gsub(/\*/,'').strip }
157+
158+
# Tags are remote branches that start with "tags/".
155159
@tags = @remote.find_all { |b| b.strip =~ %r{^tags\/} }
156160
end
157161

0 commit comments

Comments
 (0)