diff --git a/pkg/recorder/recorder.go b/pkg/recorder/recorder.go index c8210d5..28af094 100644 --- a/pkg/recorder/recorder.go +++ b/pkg/recorder/recorder.go @@ -188,6 +188,10 @@ func (w *Listener) deleteObsoleteFiles() { root := filepath.Clean(w.localDir) err := afero.Walk(appFs, root, func(path string, info os.FileInfo, err error) error { + if info == nil { + return fmt.Errorf("can't stat %s", path) + } + if info.IsDir() { return nil } diff --git a/pkg/store/git/git.go b/pkg/store/git/git.go index 60f05ae..ff2108d 100644 --- a/pkg/store/git/git.go +++ b/pkg/store/git/git.go @@ -163,6 +163,11 @@ func (s *Store) CloneOrInit() (err error) { } } + // One may both sync with a remote repos and keep a persistent local clone + if _, err := os.Stat(fmt.Sprintf("%s/.git/index", s.LocalDir)); err == nil { + return nil + } + if s.URL == "" { err = s.Git("init", s.LocalDir) } else { diff --git a/pkg/store/git/git_test.go b/pkg/store/git/git_test.go index 4140535..af6e9c3 100644 --- a/pkg/store/git/git_test.go +++ b/pkg/store/git/git_test.go @@ -124,8 +124,8 @@ func TestGit(t *testing.T) { // test various failure modes _, err = repo.Start() - if err == nil { - t.Error("Start/Clone on an existing repository should fail") + if err != nil { + t.Error("Start/Clone on an existing repository should not fail") } err = repo.Git("fortzob", "42")