all repos

mugit @ 2efe21ec179374462c5ff86d49e0d196f3a86661

馃惍 git server that your cow will love
1 files changed, 12 insertions(+), 4 deletions(-)
git: use more git-way to get description
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-01-22 01:48:03 +0200
Authored at: 2026-01-21 20:12:30 +0200
Change ID: mrxkynnzzvvqrzmrorrturwzypzzmyun
Parent: 20913e1
M internal/git/repo.go
路路路
        2
        2
         

      
        3
        3
         import (

      
        4
        4
         	"fmt"

      
        
        5
        +	"os"

      
        
        6
        +	"path/filepath"

      
        5
        7
         	"sort"

      
        6
        8
         

      
        7
        9
         	"github.com/go-git/go-git/v5"

      路路路
        140
        142
         }

      
        141
        143
         

      
        142
        144
         func (g *Repo) Description() (string, error) {

      
        143
        
        -	c, err := g.r.Config()

      
        
        145
        +	// TODO: ??? Support both mugit.description and /description file

      
        
        146
        +

      
        
        147
        +	path := filepath.Join(g.path, "description")

      
        
        148
        +	if _, err := os.Stat(path); err != nil {

      
        
        149
        +		return "", fmt.Errorf("no description file found")

      
        
        150
        +	}

      
        
        151
        +

      
        
        152
        +	d, err := os.ReadFile(path)

      
        144
        153
         	if err != nil {

      
        145
        
        -		return "", fmt.Errorf("failed to read config: %w", err)

      
        
        154
        +		return "", fmt.Errorf("failed to read description: %w", err)

      
        146
        155
         	}

      
        147
        156
         

      
        148
        
        -	s := c.Raw.Section("mugit")

      
        149
        
        -	return s.Options.Get("description"), nil

      
        
        157
        +	return string(d), nil

      
        150
        158
         }

      
        151
        159
         

      
        152
        160
         func (g *Repo) IsPrivate() (bool, error) {