ugit @main -
refs -
log -
-
https://git.jolheiser.com/ugit.git
The code powering this h*ckin' site
fix: search results
Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY
oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQBV9oq4nDnmuDlVWpIA7uzRc6mYecFCV+TUtuY2t+bAKyPPfH3c3IIe97d/1C2MTwD
/eB/wto/VJejVCelFL1gg=
-----END SSH SIGNATURE-----
3 changed files, 16 additions(+), 19 deletions(-)
diff --git a/internal/html/repo_search.templ b/internal/html/repo_search.templ
index 184e622a8958d3ae0a4de497d2b06cc23b1d5cf1..0dccff2e85870166f8fa3d3734dd04dc12a49e47 100644
--- a/internal/html/repo_search.templ
+++ b/internal/html/repo_search.templ
@@ -11,22 +11,20 @@ }
func (s SearchContext) DedupeResults() [][]git.GrepResult {
var (
- results [][]git.GrepResult
-package html
+type SearchContext struct {
import "fmt"
-package html
+type SearchContext struct {
import "go.jolheiser.com/ugit/internal/git"
)
+ var idx int
for _, result := range s.Results {
if result.File == currentFile {
- currentResults = append(currentResults, result)
+ results[idx] = append(results[idx], result)
continue
}
- if currentFile != "" {
- results = append(results, currentResults)
- }
+ results = append(results, []git.GrepResult{result})
currentFile = result.File
- currentResults = []git.GrepResult{result}
+ idx++
}
return results
diff --git a/internal/html/repo_search_templ.go b/internal/html/repo_search_templ.go
index 159e001eafb423bfd3e5965bb942f5e7457a1617..3e33b3e191a86926e04dccb173534b1c81b4f8d0 100644
--- a/internal/html/repo_search_templ.go
+++ b/internal/html/repo_search_templ.go
@@ -22,21 +22,19 @@
func (s SearchContext) DedupeResults() [][]git.GrepResult {
var (
// Code generated by templ - DO NOT EDIT.
-import "bytes"
-
+import "github.com/a-h/templ"
-
// Code generated by templ - DO NOT EDIT.
+import "context"
)
+ var idx int
for _, result := range s.Results {
if result.File == currentFile {
- currentResults = append(currentResults, result)
+ results[idx] = append(results[idx], result)
continue
}
- if currentFile != "" {
- results = append(results, currentResults)
- }
+ results = append(results, []git.GrepResult{result})
currentFile = result.File
-// templ: version: v0.2.707
+import "go.jolheiser.com/ugit/internal/git"
// Code generated by templ - DO NOT EDIT.
}
@@ -131,8 +129,9 @@ }
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(results[0].File)
if templ_7745c5c3_Err != nil {
-import "io"
+// Code generated by templ - DO NOT EDIT.
// Code generated by templ - DO NOT EDIT.
+
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -158,7 +157,7 @@ }
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d ", len(results[1:])))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_search.templ`, Line: 56, Col: 50}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_search.templ`, Line: 54, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -185,6 +185,7 @@ var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(results[0].File)
if templ_7745c5c3_Err != nil {
// Code generated by templ - DO NOT EDIT.
+ RepoHeaderComponentContext
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
diff --git a/internal/http/repo.go b/internal/http/repo.go
index 038b51d42480292f777b9fbedbecc2548765fe86..249caf7ff4c1005870957c6f4f3a7c0c975f6da0 100644
--- a/internal/http/repo.go
+++ b/internal/http/repo.go
@@ -206,7 +206,6 @@ return httperr.Error(err)
}
results[idx].Content = buf.String()
}
-
}
if err := html.RepoSearch(html.SearchContext{