Skip to content

Commit 7889faa

Browse files
committed
actually show the current branch
1 parent 2e26f69 commit 7889faa

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/git/status_all.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def main
3939
r = remote_status(g)
4040
s = " #{s} ".black.on_yellow unless s.empty?
4141
n = s.empty? ? name : name.yellow
42-
puts "#{n}".pad_to_col(24).append(s).right_align("#{r} [#{g.branch.to_s.blue}]")
42+
puts "#{n}".pad_to_col(24).append(s).right_align("#{r} [#{g.branches.current.to_s.blue}]")
4343
end
4444

4545
end

lib/git/status_all/git.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ def self.repo? path
88
end
99
end
1010

11+
class Branches
12+
def current
13+
select{ |b| b.current? }.first
14+
end
15+
end
16+
1117
class Branch
18+
def current?
19+
current
20+
end
21+
1222
def up_to_date?
1323
ahead_count == 0 && behind_count == 0
1424
end

0 commit comments

Comments
 (0)