Diff
1diff --git a/config/config.go b/config/config.go
2index 17c97d0e96a93acac5a4dc4bfb19672957fd2070..f36c943312f7b119283fa332df9fe8dd53aabe8d 100644
3--- a/config/config.go
4+++ b/config/config.go
5@@ -1,8 +1,6 @@
6 package config
7
8 import (
9- "log"
10-
11 "gopkg.in/yaml.v2"
12
13 "fmt"
14@@ -10,7 +8,6 @@ import (
15 "path/filepath"
16 "soft-serve/git"
17
18- "github.com/gliderlabs/ssh"
19 gg "github.com/go-git/go-git/v5"
20 "github.com/go-git/go-git/v5/plumbing/object"
21 )
22@@ -30,7 +27,7 @@ type User struct {
23 Name string `yaml:"name"`
24 Admin bool `yaml:"admin"`
25 PublicKey string `yaml:"public-key"`
26- CollabRepos []string `yaml:"collab_repos"`
27+ CollabRepos []string `yaml:"collab-repos"`
28 }
29
30 type Repo struct {
31@@ -71,13 +68,6 @@ func NewConfig(host string, port int, pk string, rs *git.RepoSource) (*Config, e
32 return cfg, nil
33 }
34
35-func (cfg *Config) Pushed(repo string, pk ssh.PublicKey) {
36- err := cfg.reload()
37- if err != nil {
38- log.Printf("error reloading after push: %s", err)
39- }
40-}
41-
42 func (cfg *Config) reload() error {
43 err := cfg.Source.LoadRepos()
44 if err != nil {
45diff --git a/config/auth.go b/config/git.go
46rename from config/auth.go
47rename to config/git.go
48index 879f694dda189fc7ebbae0a9490cc296b4842698..0e559508fd2dd74e3ac9857e78d17790044141c0 100644
49--- a/config/auth.go
50+++ b/config/git.go
51@@ -7,6 +7,18 @@ import (
52 "github.com/gliderlabs/ssh"
53 )
54
55+func (cfg *Config) Push(repo string, pk ssh.PublicKey) {
56+ log.Printf("git push: %s", repo)
57+ err := cfg.reload()
58+ if err != nil {
59+ log.Printf("error reloading after push: %s", err)
60+ }
61+}
62+
63+func (cfg *Config) Fetch(repo string, pk ssh.PublicKey) {
64+ log.Printf("git fetch: %s", repo)
65+}
66+
67 func (cfg *Config) AuthRepo(repo string, pk ssh.PublicKey) gm.AccessLevel {
68 return cfg.accessForKey(repo, pk)
69 }
70diff --git a/main.go b/main.go
71index 3992f3b28707080bf6b2a471f5319afbe83a7195..9ee1f8d3bd2d5b26d2b3ca36e2dd643878a9821d 100644
72--- a/main.go
73+++ b/main.go
74@@ -44,7 +44,7 @@ func main() {
75 wish.WithHostKeyPath(scfg.KeyPath),
76 wish.WithMiddlewares(
77 bm.Middleware(tui.SessionHandler(cfg)),
78- gm.MiddlewareWithPushCallback(scfg.RepoPath, cfg, cfg.Pushed),
79+ gm.Middleware(scfg.RepoPath, cfg),
80 lm.Middleware(),
81 ),
82 )