Don't keep repository & worktree open

This commit is contained in:
Christian Muehlhaeuser
2019-08-05 22:16:24 +02:00
parent 550183b75e
commit 50018c4bdf

View File

@@ -125,6 +125,9 @@ func main() {
} }
path := flag.Args()[0] path := flag.Args()[0]
for {
log.Println("Checking repository:", path)
r, err := git.PlainOpen(path) r, err := git.PlainOpen(path)
if err != nil { if err != nil {
fatal("cannot open repository: %s\n", err) fatal("cannot open repository: %s\n", err)
@@ -134,12 +137,11 @@ func main() {
fatal("cannot access repository: %s\n", err) fatal("cannot access repository: %s\n", err)
} }
for {
log.Println("Checking repository:", path)
err = gitPull(r, w, auth) err = gitPull(r, w, auth)
if err != nil { if err != nil {
fatal("cannot pull from repository: %s\n", err) fatal("cannot pull from repository: %s\n", err)
} }
status, err := w.Status() status, err := w.Status()
if err != nil { if err != nil {
fatal("cannot retrieve git status: %s\n", err) fatal("cannot retrieve git status: %s\n", err)