Skip to content

Commit 5596a90

Browse files
committed
Support using both remote repos and a persistent clone
1 parent 929386f commit 5596a90

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

pkg/recorder/recorder.go

+4
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ func (w *Listener) deleteObsoleteFiles() {
188188
root := filepath.Clean(w.localDir)
189189

190190
err := afero.Walk(appFs, root, func(path string, info os.FileInfo, err error) error {
191+
if info == nil {
192+
return fmt.Errorf("can't stat %s", path)
193+
}
194+
191195
if info.IsDir() {
192196
return nil
193197
}

pkg/store/git/git.go

+5
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ func (s *Store) CloneOrInit() (err error) {
163163
}
164164
}
165165

166+
// One may both sync with a remote repos and keep a persistent local clone
167+
if _, err := os.Stat(fmt.Sprintf("%s/.git/index", s.LocalDir)); err == nil {
168+
return nil
169+
}
170+
166171
if s.URL == "" {
167172
err = s.Git("init", s.LocalDir)
168173
} else {

pkg/store/git/git_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ func TestGit(t *testing.T) {
124124
// test various failure modes
125125

126126
_, err = repo.Start()
127-
if err == nil {
128-
t.Error("Start/Clone on an existing repository should fail")
127+
if err != nil {
128+
t.Error("Start/Clone on an existing repository should not fail")
129129
}
130130

131131
err = repo.Git("fortzob", "42")

0 commit comments

Comments
 (0)