mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 19:38:57 +00:00
remove unused code
This commit is contained in:
parent
e6578857cf
commit
ccc201ea5f
@ -20,10 +20,6 @@ import (
|
|||||||
"github.com/pkg/sftp"
|
"github.com/pkg/sftp"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
tempfileRandomSuffixLength = 10
|
|
||||||
)
|
|
||||||
|
|
||||||
// SFTP is a backend in a directory accessed via SFTP.
|
// SFTP is a backend in a directory accessed via SFTP.
|
||||||
type SFTP struct {
|
type SFTP struct {
|
||||||
c *sftp.Client
|
c *sftp.Client
|
||||||
@ -263,38 +259,6 @@ func (r *SFTP) mkdirAll(dir string, mode os.FileMode) error {
|
|||||||
return r.c.Chmod(dir, mode)
|
return r.c.Chmod(dir, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rename temp file to final name according to type and name.
|
|
||||||
func (r *SFTP) renameFile(oldname string, h restic.Handle) error {
|
|
||||||
filename := r.Filename(h)
|
|
||||||
|
|
||||||
// create directories if necessary
|
|
||||||
if h.Type == restic.DataFile {
|
|
||||||
err := r.mkdirAll(path.Dir(filename), backend.Modes.Dir)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// test if new file exists
|
|
||||||
if _, err := r.c.Lstat(filename); err == nil {
|
|
||||||
return errors.Errorf("Close(): file %v already exists", filename)
|
|
||||||
}
|
|
||||||
|
|
||||||
err := r.c.Rename(oldname, filename)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "Rename")
|
|
||||||
}
|
|
||||||
|
|
||||||
// set mode to read-only
|
|
||||||
fi, err := r.c.Lstat(filename)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "Lstat")
|
|
||||||
}
|
|
||||||
|
|
||||||
err = r.c.Chmod(filename, fi.Mode()&os.FileMode(^uint32(0222)))
|
|
||||||
return errors.Wrap(err, "Chmod")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Join joins the given paths and cleans them afterwards. This always uses
|
// Join joins the given paths and cleans them afterwards. This always uses
|
||||||
// forward slashes, which is required by sftp.
|
// forward slashes, which is required by sftp.
|
||||||
func Join(parts ...string) string {
|
func Join(parts ...string) string {
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
const data = `"foo" "bar" baz "test argument" another 'test arg' "last \" argument" 'another \" last argument'`
|
|
||||||
|
|
||||||
// shellSplitter splits a command string into separater arguments. It supports
|
// shellSplitter splits a command string into separater arguments. It supports
|
||||||
// single and double quoted strings.
|
// single and double quoted strings.
|
||||||
type shellSplitter struct {
|
type shellSplitter struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user