forked from go-git/go-git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_server_info.go
More file actions
34 lines (28 loc) · 869 Bytes
/
update_server_info.go
File metadata and controls
34 lines (28 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"fmt"
"os"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/serverinfo"
"github.com/go-git/go-git/v5/storage/filesystem"
)
// CmdUpdateServerInfo command updates the server info files in the repository.
// This is used by git http transport (dumb) to generate a list of available
// refs for the repository. See:
// https://git-scm.com/docs/git-update-server-info
type CmdUpdateServerInfo struct {
cmd
}
// Usage returns the usage of the command.
func (CmdUpdateServerInfo) Usage() string {
return fmt.Sprintf("within a git repository run: %s", os.Args[0])
}
// Execute runs the command.
func (c *CmdUpdateServerInfo) Execute(args []string) error {
r, err := git.PlainOpen(".")
if err != nil {
return err
}
fs := r.Storer.(*filesystem.Storage).Filesystem()
return serverinfo.UpdateServerInfo(r.Storer, fs)
}