Skip to content

Commit a72b26b

Browse files
authored
added columns for ahead and behind quantity of commits (#16)
* fix: now repositories ahead or behind are treated as dirty (according the documentation) * added columns for ahead and behind quantity of commits
1 parent f5deaec commit a72b26b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

internal/gitstatus/gitstatus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Status(repoPath string) (model.RepoStatus, error) {
3434
applyFileLine(&status, line)
3535
}
3636

37-
status.IsDirty = status.Staged > 0 || status.Unstaged > 0 || status.Untracked > 0
37+
status.IsDirty = status.Staged > 0 || status.Unstaged > 0 || status.Untracked > 0 || status.Ahead > 0 || status.Behind > 0
3838

3939
if t, err := lastCommitTime(repoPath); err == nil {
4040
status.LastCommit = t

internal/tui/model.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ func NewModel(cfg *config.Config) Model {
8888
{Title: "Staged", Width: 6},
8989
{Title: "Modified", Width: 8},
9090
{Title: "Untracked", Width: 9},
91+
{Title: "Ahead", Width: 7},
92+
{Title: "Behind", Width: 7},
9193
{Title: "Last Commit", Width: 14},
9294
}
9395

@@ -335,6 +337,8 @@ func reposToRows(repos []model.Repo) []table.Row {
335337
formatNumber(r.Status.Staged),
336338
formatNumber(r.Status.Unstaged),
337339
formatNumber(r.Status.Untracked),
340+
formatNumber(r.Status.Ahead),
341+
formatNumber(r.Status.Behind),
338342
lastCommit,
339343
})
340344
}

0 commit comments

Comments
 (0)