1
0
mirror of https://github.com/restic/restic.git synced 2024-06-29 08:10:52 +02:00

Remove tests for directories

For testing whether a repository already exists it is sufficient to
test if the config file (and therefore the master key) exists.

Closes #279
This commit is contained in:
Alexander Neumann 2015-08-26 21:51:40 +02:00
parent 9aefc2b7a6
commit b211f834fa
2 changed files with 0 additions and 14 deletions

View File

@ -62,13 +62,6 @@ func Create(dir string) (*Local, error) {
return nil, errors.New("config file already exists")
}
// test if directories already exist
for _, d := range dirs[1:] {
if _, err := os.Stat(d); err == nil {
return nil, fmt.Errorf("dir %s already exists", d)
}
}
// create paths for data, refs and temp
for _, d := range dirs {
err := os.MkdirAll(d, backend.Modes.Dir)

View File

@ -115,13 +115,6 @@ func Create(dir string, program string, args ...string) (*SFTP, error) {
return nil, errors.New("config file already exists")
}
// test if directories already exist
for _, d := range dirs[1:] {
if _, err := sftp.c.Lstat(d); err == nil {
return nil, fmt.Errorf("dir %s already exists", d)
}
}
// create paths for data, refs and temp blobs
for _, d := range dirs {
err = sftp.mkdirAll(d, backend.Modes.Dir)