Delete the tempdir on wc.Destroy instead of running cleanPath - fixes #20
diff --git a/gbvendor/repo.go b/gbvendor/repo.go
index 54b9b40..88c177f 100644
--- a/gbvendor/repo.go
+++ b/gbvendor/repo.go
@@ -41,7 +41,7 @@
// Branch returns the branch to which this working copy belongs.
Branch() (string, error)
- // Destroy removes the working copy and cleans path to the working copy.
+ // Destroy removes the working copy.
Destroy() error
}
@@ -341,11 +341,7 @@
func (w workingcopy) Dir() string { return w.path }
func (w workingcopy) Destroy() error {
- if err := fileutils.RemoveAll(w.path); err != nil {
- return err
- }
- parent := filepath.Dir(w.path)
- return cleanPath(parent)
+ return fileutils.RemoveAll(w.path)
}
// GitClone is a git WorkingCopy.
@@ -492,6 +488,14 @@
return "master", nil
}
+func (b *BzrClone) Destroy() error {
+ if err := (workingcopy{b.path}).Destroy(); err != nil {
+ return err
+ }
+ parent := filepath.Dir(b.path)
+ return os.Remove(parent)
+}
+
func cleanPath(path string) error {
if files, _ := ioutil.ReadDir(path); len(files) > 0 || filepath.Base(path) == "vendor" {
return nil
@@ -503,10 +507,6 @@
return cleanPath(parent)
}
-func mkdir(path string) error {
- return os.MkdirAll(path, 0755)
-}
-
func mktmp() (string, error) {
return ioutil.TempDir("", "gvt-")
}