Compare commits

..

No commits in common. "c33dfdc42acc068a865200694b804bb21dd0e36e" and "028fde649f14abce9a4589261e4e01dd734b7e0b" have entirely different histories.

3 changed files with 9 additions and 24 deletions

View File

@ -3,7 +3,6 @@ package html
import (
"fmt"
"strings"
"path"
)
type RepoBreadcrumbComponentContext struct {
@ -23,13 +22,13 @@ func (r RepoBreadcrumbComponentContext) crumbs() []breadcrumb {
breadcrumbs := []breadcrumb{
{
label: r.Repo,
href: fmt.Sprintf("/%s/tree/%s/", r.Repo, r.Ref),
href: fmt.Sprintf("/%s/tree/%s", r.Repo, r.Ref),
},
}
for idx, part := range parts {
breadcrumbs = append(breadcrumbs, breadcrumb{
label: part,
href: path.Join(breadcrumbs[idx].href, part),
href: breadcrumbs[idx].href + "/" + part,
})
}
breadcrumbs[len(breadcrumbs)-1].end = true

View File

@ -12,7 +12,6 @@ import "bytes"
import (
"fmt"
"path"
"strings"
)
@ -33,13 +32,13 @@ func (r RepoBreadcrumbComponentContext) crumbs() []breadcrumb {
breadcrumbs := []breadcrumb{
{
label: r.Repo,
href: fmt.Sprintf("/%s/tree/%s/", r.Repo, r.Ref),
href: fmt.Sprintf("/%s/tree/%s", r.Repo, r.Ref),
},
}
for idx, part := range parts {
breadcrumbs = append(breadcrumbs, breadcrumb{
label: part,
href: path.Join(breadcrumbs[idx].href, part),
href: breadcrumbs[idx].href + "/" + part,
})
}
breadcrumbs[len(breadcrumbs)-1].end = true
@ -73,7 +72,7 @@ func repoBreadcrumbComponent(rbcc RepoBreadcrumbComponentContext) templ.Componen
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 44, Col: 24}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 43, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@ -100,7 +99,7 @@ func repoBreadcrumbComponent(rbcc RepoBreadcrumbComponentContext) templ.Componen
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(crumb.label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 46, Col: 134}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 45, Col: 134}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@ -113,7 +112,7 @@ func repoBreadcrumbComponent(rbcc RepoBreadcrumbComponentContext) templ.Componen
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(" / ")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 47, Col: 12}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `repo_breadcrumb.templ`, Line: 46, Col: 12}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {

View File

@ -8,7 +8,6 @@ import (
"os"
"path/filepath"
"strings"
"text/tabwriter"
"go.jolheiser.com/ugit/internal/git"
@ -105,22 +104,10 @@ func Middleware(repoDir string, cloneURL string, port int, gh Hooks) wish.Middle
if err != nil && err != fs.ErrNotExist {
log.Error("invalid repository", "error", err)
}
tw := tabwriter.NewWriter(s, 0, 0, 1, ' ', 0)
for _, de := range des {
if filepath.Ext(de.Name()) != ".git" {
continue
}
repo, err := git.NewRepo(repoDir, de.Name())
visibility := "❓"
if err == nil {
visibility = "🔓"
if repo.Meta.Private {
visibility = "🔒"
}
}
fmt.Fprintf(tw, "%[1]s\t%[3]s\t%[2]s/%[1]s.git\n", strings.TrimSuffix(de.Name(), ".git"), cloneURL, visibility)
fmt.Fprintln(s, de.Name())
fmt.Fprintf(s, "\tgit clone %s/%s\n", cloneURL, de.Name())
}
tw.Flush()
}
sh(s)
}