From 8b4ee572de2c395023bcf50fc7186309aa3a7354 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 5 Apr 2022 17:05:27 -0400 Subject: [PATCH] fix: show log for a specific reference don't reset log reference when already set --- pkg/git/repo.go | 5 ++++- pkg/tui/log/bubble.go | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/git/repo.go b/pkg/git/repo.go index dc749c797dc1383e7851d46257b1184343dc1646..6eb0e07e3ec09ba66e0f0e4b811b7b465da94d36 100644 --- a/pkg/git/repo.go +++ b/pkg/git/repo.go @@ -7,8 +7,11 @@ import ( ) var ( - DiffMaxFiles = 1000 + // DiffMaxFile is the maximum number of files to show in a diff. + DiffMaxFiles = 1000 + // DiffMaxFileLines is the maximum number of lines to show in a file diff. DiffMaxFileLines = 1000 + // DiffMaxLineChars is the maximum number of characters to show in a line diff. DiffMaxLineChars = 1000 ) diff --git a/pkg/tui/log/bubble.go b/pkg/tui/log/bubble.go index 2a5c84bac77079c709363eec776fc966419c183c..e58b6d5ba15d286e33cb62a296565380da1a6919 100644 --- a/pkg/tui/log/bubble.go +++ b/pkg/tui/log/bubble.go @@ -136,12 +136,14 @@ func (b *Bubble) reset() tea.Cmd { errMsg := func(err error) tea.Cmd { return func() tea.Msg { return common.ErrMsg{Err: err} } } - ref, err := b.repo.HEAD() - if err != nil { - return errMsg(err) + if b.ref == nil { + ref, err := b.repo.HEAD() + if err != nil { + return errMsg(err) + } + b.ref = ref } - b.ref = ref - count, err := b.repo.CountCommits(ref) + count, err := b.repo.CountCommits(b.ref) if err != nil { return errMsg(err) }