2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-12 06:07:55 +00:00

Merge pull request #703 from sjoerdsimons/master

Avoid duplicate backup paths
This commit is contained in:
Alexander Neumann 2016-12-19 22:21:18 +01:00
commit 3add2f0acb

View File

@ -289,7 +289,7 @@ func readLinesFromFile(filename string) ([]string, error) {
} }
func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error { func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error {
target, err := readLinesFromFile(opts.FilesFrom) fromfile, err := readLinesFromFile(opts.FilesFrom)
if err != nil { if err != nil {
return err return err
} }
@ -297,11 +297,12 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error {
// merge files from files-from into normal args so we can reuse the normal // merge files from files-from into normal args so we can reuse the normal
// args checks and have the ability to use both files-from and args at the // args checks and have the ability to use both files-from and args at the
// same time // same time
args = append(args, target...) args = append(args, fromfile...)
if len(args) == 0 { if len(args) == 0 {
return errors.Fatalf("wrong number of parameters") return errors.Fatalf("wrong number of parameters")
} }
target := make([]string, 0, len(args))
for _, d := range args { for _, d := range args {
if a, err := filepath.Abs(d); err == nil { if a, err := filepath.Abs(d); err == nil {
d = a d = a