mirror of
https://github.com/restic/restic.git
synced 2026-06-17 22:24:17 +00:00
archiver: unexport BackupTarget type
This commit is contained in:
@@ -781,9 +781,9 @@ func (arch *Archiver) dirPathToNode(snPath, target string) (node *data.Node, err
|
||||
//
|
||||
// Paths returned with Explicit true are those the user listed literally; paths
|
||||
// inserted from directory expansion have Explicit false.
|
||||
func resolveRelativeTargets(filesys fs.FS, targets []string) ([]BackupTarget, error) {
|
||||
func resolveRelativeTargets(filesys fs.FS, targets []string) ([]backupTarget, error) {
|
||||
debug.Log("targets before resolving: %v", targets)
|
||||
result := make([]BackupTarget, 0, len(targets))
|
||||
result := make([]backupTarget, 0, len(targets))
|
||||
for _, target := range targets {
|
||||
if target != "" && filesys.VolumeName(target) == target {
|
||||
// special case to allow users to also specify a volume name "C:" instead of a path "C:\"
|
||||
@@ -793,7 +793,7 @@ func resolveRelativeTargets(filesys fs.FS, targets []string) ([]BackupTarget, er
|
||||
}
|
||||
pc, _ := pathComponents(filesys, target, false)
|
||||
if len(pc) > 0 {
|
||||
result = append(result, BackupTarget{Path: target, Explicit: true})
|
||||
result = append(result, backupTarget{Path: target, Explicit: true})
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ func resolveRelativeTargets(filesys fs.FS, targets []string) ([]BackupTarget, er
|
||||
sort.Strings(entries)
|
||||
|
||||
for _, name := range entries {
|
||||
result = append(result, BackupTarget{
|
||||
result = append(result, backupTarget{
|
||||
Path: filesys.Join(target, name),
|
||||
Explicit: false,
|
||||
})
|
||||
|
||||
@@ -274,16 +274,16 @@ func unrollTree(f fs.FS, t *tree) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// BackupTarget is a resolved backup path and whether the user passed this path
|
||||
// backupTarget is a resolved backup path and whether the user passed this path
|
||||
// literally. Paths inserted when expanding a target with no path components
|
||||
// (for example ".") have Explicit false so include/exclude rules still apply.
|
||||
type BackupTarget struct {
|
||||
type backupTarget struct {
|
||||
Path string
|
||||
Explicit bool
|
||||
}
|
||||
|
||||
// newTree creates a Tree from the target files/directories.
|
||||
func newTree(fs fs.FS, targets []BackupTarget) (*tree, error) {
|
||||
func newTree(fs fs.FS, targets []backupTarget) (*tree, error) {
|
||||
debug.Log("targets: %v", targets)
|
||||
tree := &tree{}
|
||||
seen := make(map[string]struct{})
|
||||
|
||||
@@ -14,10 +14,10 @@ import (
|
||||
// debug.Log requires Tree.String.
|
||||
var _ fmt.Stringer = tree{}
|
||||
|
||||
func testBackupTargets(paths []string) []BackupTarget {
|
||||
tgts := make([]BackupTarget, len(paths))
|
||||
func testBackupTargets(paths []string) []backupTarget {
|
||||
tgts := make([]backupTarget, len(paths))
|
||||
for i, p := range paths {
|
||||
tgts[i] = BackupTarget{Path: p, Explicit: true}
|
||||
tgts[i] = backupTarget{Path: p, Explicit: true}
|
||||
}
|
||||
return tgts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user