8b4ee572de2c395023bcf50fc7186309aa3a7354

Author
Ayman Bagabas <ayman.bagabas@gmail.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

fix: show log for a specific reference

don't reset log reference when already set

Diff

 1diff --git a/pkg/git/repo.go b/pkg/git/repo.go
 2index dc749c797dc1383e7851d46257b1184343dc1646..6eb0e07e3ec09ba66e0f0e4b811b7b465da94d36 100644
 3--- a/pkg/git/repo.go
 4+++ b/pkg/git/repo.go
 5@@ -7,8 +7,11 @@ import (
 6 )
 7 
 8 var (
 9-	DiffMaxFiles     = 1000
10+	// DiffMaxFile is the maximum number of files to show in a diff.
11+	DiffMaxFiles = 1000
12+	// DiffMaxFileLines is the maximum number of lines to show in a file diff.
13 	DiffMaxFileLines = 1000
14+	// DiffMaxLineChars is the maximum number of characters to show in a line diff.
15 	DiffMaxLineChars = 1000
16 )
17 
18diff --git a/pkg/tui/log/bubble.go b/pkg/tui/log/bubble.go
19index 2a5c84bac77079c709363eec776fc966419c183c..e58b6d5ba15d286e33cb62a296565380da1a6919 100644
20--- a/pkg/tui/log/bubble.go
21+++ b/pkg/tui/log/bubble.go
22@@ -136,12 +136,14 @@ func (b *Bubble) reset() tea.Cmd {
23 	errMsg := func(err error) tea.Cmd {
24 		return func() tea.Msg { return common.ErrMsg{Err: err} }
25 	}
26-	ref, err := b.repo.HEAD()
27-	if err != nil {
28-		return errMsg(err)
29+	if b.ref == nil {
30+		ref, err := b.repo.HEAD()
31+		if err != nil {
32+			return errMsg(err)
33+		}
34+		b.ref = ref
35 	}
36-	b.ref = ref
37-	count, err := b.repo.CountCommits(ref)
38+	count, err := b.repo.CountCommits(b.ref)
39 	if err != nil {
40 		return errMsg(err)
41 	}