Detailed changes
@@ -2,14 +2,12 @@ package repo
import (
"fmt"
- "strings"
"github.com/charmbracelet/soft-serve/server/config"
+ "github.com/charmbracelet/soft-serve/ui/common"
)
func defaultEmptyRepoMsg(cfg *config.Config, repo string) string {
- publicURL := cfg.SSH.PublicURL
- repo = strings.TrimSuffix(repo, ".git")
return fmt.Sprintf(`# Quick Start
Get started by cloning this repository, add your files, commit, and push.
@@ -17,7 +15,7 @@ Get started by cloning this repository, add your files, commit, and push.
## Clone this repository.
`+"```"+`sh
-git clone %[1]s/%[2]s.git
+git clone %[1]s
`+"```"+`
## Creating a new repository on the command line
@@ -28,15 +26,15 @@ git init
git add README.md
git branch -M main
git commit -m "first commit"
-git remote add origin %[1]s/%[2]s.git
+git remote add origin %[1]s
git push -u origin main
`+"```"+`
## Pushing an existing repository from the command line
`+"```"+`sh
-git remote add origin %[1]s/%[2]s.git
+git remote add origin %[1]s
git push -u origin main
`+"```"+`
-`, publicURL, repo)
+`, common.RepoURL(cfg.SSH.PublicURL, repo))
}
@@ -117,10 +117,7 @@ func (r *Readme) updateReadmeCmd() tea.Msg {
if r.repo == nil {
return common.ErrorCmd(common.ErrMissingRepo)
}
- rm, rp, err := backend.Readme(r.repo)
- if err != nil {
- return common.ErrorCmd(err)
- }
+ rm, rp, _ := backend.Readme(r.repo)
r.readmePath = rp
r.code.GotoTop()
cmd := r.code.SetContent(rm, rp)
@@ -222,11 +222,12 @@ func UpdateRefCmd(repo backend.Repository) tea.Cmd {
if err != nil {
return common.ErrorMsg(err)
}
+ bs, _ := r.Branches()
+ if len(bs) == 0 {
+ return EmptyRepoMsg{}
+ }
ref, err := r.HEAD()
if err != nil {
- if bs, err := r.Branches(); err != nil && len(bs) == 0 {
- return EmptyRepoMsg{}
- }
logger.Debugf("ui: error getting HEAD reference: %v", err)
return common.ErrorMsg(err)
}
@@ -180,6 +180,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
r.tabs.Init(),
// This will set the selected repo in each pane's model.
r.updateModels(msg),
+ r.spinner.Tick,
)
case RefMsg:
r.ref = msg
@@ -413,7 +413,7 @@ func DefaultStyles() *Styles {
s.NoContent = lipgloss.NewStyle().
SetString("No Content.").
- MarginTop(2).
+ MarginTop(1).
MarginLeft(2).
Foreground(lipgloss.Color("242"))