@@ -112,8 +112,11 @@ type LSPDiagnosticsMsg struct {
112112
113113 // gitBranchMsg carries the current git branch and dirty status.
114114 type gitBranchMsg struct {
115- branch string
116- dirty bool
115+ branch string
116+ dirty bool
117+ added int
118+ modified int
119+ removed int
117120 }
118121
119122 // ---------------------------------------------------------------------------
@@ -127,6 +130,42 @@ func frameTick() tea.Cmd {
127130 })
128131 }
129132
133+func gitStatusCounts() (added int, modified int, removed int) {
134+ out, err := exec.Command("git", "status", "--porcelain").Output()
135+ if err != nil {
136+ return 0, 0, 0
137+ }
138+ trimmed := strings.TrimSpace(string(out))
139+ if trimmed == "" {
140+ return 0, 0, 0
141+ }
142+ for _, line := range strings.Split(trimmed, "\n") {
143+ if line == "" {
144+ continue
145+ }
146+ if strings.HasPrefix(line, "??") {
147+ added++
148+ continue
149+ }
150+ if len(line) < 2 {
151+ continue
152+ }
153+ x := line[0]
154+ y := line[1]
155+ if x == 'A' || y == 'A' {
156+ added++
157+ }
158+ if x == 'M' || y == 'M' || x == 'R' || y == 'R' || x == 'C' || y == 'C' {
159+ modified++
160+ }
161+ if x == 'D' || y == 'D' {
162+ removed++
163+ }
164+ }
165+ return added, modified, removed
166+}
167+
168+
130169 // gitBranchCmd runs git to detect the current branch and dirty status.
131170 func gitBranchCmd() tea.Cmd {
132171 return func() tea.Msg {
@@ -138,7 +177,8 @@ func gitBranchCmd() tea.Cmd {
138177 if err := exec.Command("git", "diff", "--quiet", "HEAD").Run(); err != nil {
139178 dirty = true // exit code 1 = dirty
140179 }
141- return gitBranchMsg{branch: branch, dirty: dirty}
180+ added, modified, removed := gitStatusCounts()
181+ return gitBranchMsg{branch: branch, dirty: dirty, added: added, modified: modified, removed: removed}
142182 }
143183 }
144184
@@ -154,7 +194,8 @@ func gitBranchTick() tea.Cmd {
154194 if err := exec.Command("git", "diff", "--quiet", "HEAD").Run(); err != nil {
155195 dirty = true
156196 }
157- return gitBranchMsg{branch: branch, dirty: dirty}
197+ added, modified, removed := gitStatusCounts()
198+ return gitBranchMsg{branch: branch, dirty: dirty, added: added, modified: modified, removed: removed}
158199 })
159200 }
160201