forked from TrueCloudLab/restic
Merge pull request #2990 from MichaelEischer/fix-goreport-warnings
Fix some goreport warnings
This commit is contained in:
commit
56883817d8
15 changed files with 103 additions and 105 deletions
|
@ -44,7 +44,6 @@ func createFileSetPerHardlink(dir string) map[uint64][]string {
|
||||||
}
|
}
|
||||||
for i, f := range files {
|
for i, f := range files {
|
||||||
linkTests[uint64(i)] = append(linkTests[uint64(i)], f.Name())
|
linkTests[uint64(i)] = append(linkTests[uint64(i)], f.Name())
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
return linkTests
|
return linkTests
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,7 +513,7 @@ func TestBackupErrors(t *testing.T) {
|
||||||
gopts := env.gopts
|
gopts := env.gopts
|
||||||
gopts.stderr = ioutil.Discard
|
gopts.stderr = ioutil.Discard
|
||||||
err := testRunBackupAssumeFailure(t, filepath.Dir(env.testdata), []string{"testdata"}, opts, gopts)
|
err := testRunBackupAssumeFailure(t, filepath.Dir(env.testdata), []string{"testdata"}, opts, gopts)
|
||||||
rtest.Assert(t, err != nil, "Assumed failure, but no error occured.")
|
rtest.Assert(t, err != nil, "Assumed failure, but no error occurred.")
|
||||||
rtest.Assert(t, err == ErrInvalidSourceData, "Wrong error returned")
|
rtest.Assert(t, err == ErrInvalidSourceData, "Wrong error returned")
|
||||||
snapshotIDs := testRunList(t, "snapshots", env.gopts)
|
snapshotIDs := testRunList(t, "snapshots", env.gopts)
|
||||||
rtest.Assert(t, len(snapshotIDs) == 1,
|
rtest.Assert(t, len(snapshotIDs) == 1,
|
||||||
|
@ -1665,7 +1665,7 @@ func TestDiff(t *testing.T) {
|
||||||
rtest.OK(t, os.Mkdir(modfile+"4", 0755))
|
rtest.OK(t, os.Mkdir(modfile+"4", 0755))
|
||||||
|
|
||||||
testRunBackup(t, "", []string{datadir}, opts, env.gopts)
|
testRunBackup(t, "", []string{datadir}, opts, env.gopts)
|
||||||
snapshots, secondSnapshotID := lastSnapshot(snapshots, loadSnapshotMap(t, env.gopts))
|
_, secondSnapshotID := lastSnapshot(snapshots, loadSnapshotMap(t, env.gopts))
|
||||||
|
|
||||||
_, err := testRunDiffOutput(env.gopts, "", secondSnapshotID)
|
_, err := testRunDiffOutput(env.gopts, "", secondSnapshotID)
|
||||||
rtest.Assert(t, err != nil, "expected error on invalid snapshot id")
|
rtest.Assert(t, err != nil, "expected error on invalid snapshot id")
|
||||||
|
|
|
@ -2094,7 +2094,7 @@ func TestMetadataChanged(t *testing.T) {
|
||||||
want.Group = ""
|
want.Group = ""
|
||||||
|
|
||||||
// make another snapshot
|
// make another snapshot
|
||||||
snapshotID, node3 := snapshot(t, repo, fs, snapshotID, "testfile")
|
_, node3 := snapshot(t, repo, fs, snapshotID, "testfile")
|
||||||
// Override username and group to empty string - in case underlying system has user with UID 51234
|
// Override username and group to empty string - in case underlying system has user with UID 51234
|
||||||
// See https://github.com/restic/restic/issues/2372
|
// See https://github.com/restic/restic/issues/2372
|
||||||
node3.User = ""
|
node3.User = ""
|
||||||
|
|
|
@ -33,15 +33,15 @@ func TestScanner(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: map[string]ScanStats{
|
want: map[string]ScanStats{
|
||||||
filepath.FromSlash("other"): ScanStats{Files: 1, Bytes: 12},
|
filepath.FromSlash("other"): {Files: 1, Bytes: 12},
|
||||||
filepath.FromSlash("work/foo"): ScanStats{Files: 2, Bytes: 15},
|
filepath.FromSlash("work/foo"): {Files: 2, Bytes: 15},
|
||||||
filepath.FromSlash("work/foo.txt"): ScanStats{Files: 3, Bytes: 28},
|
filepath.FromSlash("work/foo.txt"): {Files: 3, Bytes: 28},
|
||||||
filepath.FromSlash("work/subdir/bar.txt"): ScanStats{Files: 4, Bytes: 45},
|
filepath.FromSlash("work/subdir/bar.txt"): {Files: 4, Bytes: 45},
|
||||||
filepath.FromSlash("work/subdir/other"): ScanStats{Files: 5, Bytes: 60},
|
filepath.FromSlash("work/subdir/other"): {Files: 5, Bytes: 60},
|
||||||
filepath.FromSlash("work/subdir"): ScanStats{Files: 5, Dirs: 1, Bytes: 60},
|
filepath.FromSlash("work/subdir"): {Files: 5, Dirs: 1, Bytes: 60},
|
||||||
filepath.FromSlash("work"): ScanStats{Files: 5, Dirs: 2, Bytes: 60},
|
filepath.FromSlash("work"): {Files: 5, Dirs: 2, Bytes: 60},
|
||||||
filepath.FromSlash("."): ScanStats{Files: 5, Dirs: 3, Bytes: 60},
|
filepath.FromSlash("."): {Files: 5, Dirs: 3, Bytes: 60},
|
||||||
filepath.FromSlash(""): ScanStats{Files: 5, Dirs: 3, Bytes: 60},
|
filepath.FromSlash(""): {Files: 5, Dirs: 3, Bytes: 60},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -68,12 +68,12 @@ func TestScanner(t *testing.T) {
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
want: map[string]ScanStats{
|
want: map[string]ScanStats{
|
||||||
filepath.FromSlash("work/foo.txt"): ScanStats{Files: 1, Bytes: 13},
|
filepath.FromSlash("work/foo.txt"): {Files: 1, Bytes: 13},
|
||||||
filepath.FromSlash("work/subdir/bar.txt"): ScanStats{Files: 2, Bytes: 30},
|
filepath.FromSlash("work/subdir/bar.txt"): {Files: 2, Bytes: 30},
|
||||||
filepath.FromSlash("work/subdir"): ScanStats{Files: 2, Dirs: 1, Bytes: 30},
|
filepath.FromSlash("work/subdir"): {Files: 2, Dirs: 1, Bytes: 30},
|
||||||
filepath.FromSlash("work"): ScanStats{Files: 2, Dirs: 2, Bytes: 30},
|
filepath.FromSlash("work"): {Files: 2, Dirs: 2, Bytes: 30},
|
||||||
filepath.FromSlash("."): ScanStats{Files: 2, Dirs: 3, Bytes: 30},
|
filepath.FromSlash("."): {Files: 2, Dirs: 3, Bytes: 30},
|
||||||
filepath.FromSlash(""): ScanStats{Files: 2, Dirs: 3, Bytes: 30},
|
filepath.FromSlash(""): {Files: 2, Dirs: 3, Bytes: 30},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,34 +150,34 @@ func TestTree(t *testing.T) {
|
||||||
{
|
{
|
||||||
targets: []string{"foo"},
|
targets: []string{"foo"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Path: "foo", Root: "."},
|
"foo": {Path: "foo", Root: "."},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: []string{"foo", "bar", "baz"},
|
targets: []string{"foo", "bar", "baz"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Path: "foo", Root: "."},
|
"foo": {Path: "foo", Root: "."},
|
||||||
"bar": Tree{Path: "bar", Root: "."},
|
"bar": {Path: "bar", Root: "."},
|
||||||
"baz": Tree{Path: "baz", Root: "."},
|
"baz": {Path: "baz", Root: "."},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: []string{"foo/user1", "foo/user2", "foo/other"},
|
targets: []string{"foo/user1", "foo/user2", "foo/other"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||||
"user2": Tree{Path: filepath.FromSlash("foo/user2")},
|
"user2": {Path: filepath.FromSlash("foo/user2")},
|
||||||
"other": Tree{Path: filepath.FromSlash("foo/other")},
|
"other": {Path: filepath.FromSlash("foo/other")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: []string{"foo/work/user1", "foo/work/user2"},
|
targets: []string{"foo/work/user1", "foo/work/user2"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("foo/work/user1")},
|
"user1": {Path: filepath.FromSlash("foo/work/user1")},
|
||||||
"user2": Tree{Path: filepath.FromSlash("foo/work/user2")},
|
"user2": {Path: filepath.FromSlash("foo/work/user2")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
|
@ -185,50 +185,50 @@ func TestTree(t *testing.T) {
|
||||||
{
|
{
|
||||||
targets: []string{"foo/user1", "bar/user1", "foo/other"},
|
targets: []string{"foo/user1", "bar/user1", "foo/other"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||||
"other": Tree{Path: filepath.FromSlash("foo/other")},
|
"other": {Path: filepath.FromSlash("foo/other")},
|
||||||
}},
|
}},
|
||||||
"bar": Tree{Root: ".", FileInfoPath: "bar", Nodes: map[string]Tree{
|
"bar": {Root: ".", FileInfoPath: "bar", Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("bar/user1")},
|
"user1": {Path: filepath.FromSlash("bar/user1")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: []string{"../work"},
|
targets: []string{"../work"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"work": Tree{Root: "..", Path: filepath.FromSlash("../work")},
|
"work": {Root: "..", Path: filepath.FromSlash("../work")},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: []string{"../work/other"},
|
targets: []string{"../work/other"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"work": Tree{Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
"work": {Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
||||||
"other": Tree{Path: filepath.FromSlash("../work/other")},
|
"other": {Path: filepath.FromSlash("../work/other")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: []string{"foo/user1", "../work/other", "foo/user2"},
|
targets: []string{"foo/user1", "../work/other", "foo/user2"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||||
"user2": Tree{Path: filepath.FromSlash("foo/user2")},
|
"user2": {Path: filepath.FromSlash("foo/user2")},
|
||||||
}},
|
}},
|
||||||
"work": Tree{Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
"work": {Root: "..", FileInfoPath: filepath.FromSlash("../work"), Nodes: map[string]Tree{
|
||||||
"other": Tree{Path: filepath.FromSlash("../work/other")},
|
"other": {Path: filepath.FromSlash("../work/other")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: []string{"foo/user1", "../foo/other", "foo/user2"},
|
targets: []string{"foo/user1", "../foo/other", "foo/user2"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("foo/user1")},
|
"user1": {Path: filepath.FromSlash("foo/user1")},
|
||||||
"user2": Tree{Path: filepath.FromSlash("foo/user2")},
|
"user2": {Path: filepath.FromSlash("foo/user2")},
|
||||||
}},
|
}},
|
||||||
"foo-1": Tree{Root: "..", FileInfoPath: filepath.FromSlash("../foo"), Nodes: map[string]Tree{
|
"foo-1": {Root: "..", FileInfoPath: filepath.FromSlash("../foo"), Nodes: map[string]Tree{
|
||||||
"other": Tree{Path: filepath.FromSlash("../foo/other")},
|
"other": {Path: filepath.FromSlash("../foo/other")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
@ -241,12 +241,12 @@ func TestTree(t *testing.T) {
|
||||||
},
|
},
|
||||||
targets: []string{"foo", "foo/work"},
|
targets: []string{"foo", "foo/work"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{
|
"foo": {
|
||||||
Root: ".",
|
Root: ".",
|
||||||
FileInfoPath: "foo",
|
FileInfoPath: "foo",
|
||||||
Nodes: map[string]Tree{
|
Nodes: map[string]Tree{
|
||||||
"file": Tree{Path: filepath.FromSlash("foo/file")},
|
"file": {Path: filepath.FromSlash("foo/file")},
|
||||||
"work": Tree{Path: filepath.FromSlash("foo/work")},
|
"work": {Path: filepath.FromSlash("foo/work")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
|
@ -262,12 +262,12 @@ func TestTree(t *testing.T) {
|
||||||
},
|
},
|
||||||
targets: []string{"foo/work", "foo"},
|
targets: []string{"foo/work", "foo"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{
|
"foo": {
|
||||||
Root: ".",
|
Root: ".",
|
||||||
FileInfoPath: "foo",
|
FileInfoPath: "foo",
|
||||||
Nodes: map[string]Tree{
|
Nodes: map[string]Tree{
|
||||||
"file": Tree{Path: filepath.FromSlash("foo/file")},
|
"file": {Path: filepath.FromSlash("foo/file")},
|
||||||
"work": Tree{Path: filepath.FromSlash("foo/work")},
|
"work": {Path: filepath.FromSlash("foo/work")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
|
@ -283,12 +283,12 @@ func TestTree(t *testing.T) {
|
||||||
},
|
},
|
||||||
targets: []string{"foo/work", "foo/work/user2"},
|
targets: []string{"foo/work", "foo/work/user2"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"work": Tree{
|
"work": {
|
||||||
FileInfoPath: filepath.FromSlash("foo/work"),
|
FileInfoPath: filepath.FromSlash("foo/work"),
|
||||||
Nodes: map[string]Tree{
|
Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("foo/work/user1")},
|
"user1": {Path: filepath.FromSlash("foo/work/user1")},
|
||||||
"user2": Tree{Path: filepath.FromSlash("foo/work/user2")},
|
"user2": {Path: filepath.FromSlash("foo/work/user2")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
|
@ -305,11 +305,11 @@ func TestTree(t *testing.T) {
|
||||||
},
|
},
|
||||||
targets: []string{"foo/work/user2", "foo/work"},
|
targets: []string{"foo/work/user2", "foo/work"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"),
|
"work": {FileInfoPath: filepath.FromSlash("foo/work"),
|
||||||
Nodes: map[string]Tree{
|
Nodes: map[string]Tree{
|
||||||
"user1": Tree{Path: filepath.FromSlash("foo/work/user1")},
|
"user1": {Path: filepath.FromSlash("foo/work/user1")},
|
||||||
"user2": Tree{Path: filepath.FromSlash("foo/work/user2")},
|
"user2": {Path: filepath.FromSlash("foo/work/user2")},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
|
@ -333,17 +333,17 @@ func TestTree(t *testing.T) {
|
||||||
},
|
},
|
||||||
targets: []string{"foo/work/user2/data/secret", "foo"},
|
targets: []string{"foo/work/user2/data/secret", "foo"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"other": Tree{Path: filepath.FromSlash("foo/other")},
|
"other": {Path: filepath.FromSlash("foo/other")},
|
||||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||||
"user2": Tree{FileInfoPath: filepath.FromSlash("foo/work/user2"), Nodes: map[string]Tree{
|
"user2": {FileInfoPath: filepath.FromSlash("foo/work/user2"), Nodes: map[string]Tree{
|
||||||
"data": Tree{FileInfoPath: filepath.FromSlash("foo/work/user2/data"), Nodes: map[string]Tree{
|
"data": {FileInfoPath: filepath.FromSlash("foo/work/user2/data"), Nodes: map[string]Tree{
|
||||||
"secret": Tree{
|
"secret": {
|
||||||
Path: filepath.FromSlash("foo/work/user2/data/secret"),
|
Path: filepath.FromSlash("foo/work/user2/data/secret"),
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"user3": Tree{Path: filepath.FromSlash("foo/work/user3")},
|
"user3": {Path: filepath.FromSlash("foo/work/user3")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
|
@ -369,15 +369,15 @@ func TestTree(t *testing.T) {
|
||||||
unix: true,
|
unix: true,
|
||||||
targets: []string{"mnt/driveA", "mnt/driveA/work/driveB"},
|
targets: []string{"mnt/driveA", "mnt/driveA/work/driveB"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"mnt": Tree{Root: ".", FileInfoPath: filepath.FromSlash("mnt"), Nodes: map[string]Tree{
|
"mnt": {Root: ".", FileInfoPath: filepath.FromSlash("mnt"), Nodes: map[string]Tree{
|
||||||
"driveA": Tree{FileInfoPath: filepath.FromSlash("mnt/driveA"), Nodes: map[string]Tree{
|
"driveA": {FileInfoPath: filepath.FromSlash("mnt/driveA"), Nodes: map[string]Tree{
|
||||||
"work": Tree{FileInfoPath: filepath.FromSlash("mnt/driveA/work"), Nodes: map[string]Tree{
|
"work": {FileInfoPath: filepath.FromSlash("mnt/driveA/work"), Nodes: map[string]Tree{
|
||||||
"driveB": Tree{
|
"driveB": {
|
||||||
Path: filepath.FromSlash("mnt/driveA/work/driveB"),
|
Path: filepath.FromSlash("mnt/driveA/work/driveB"),
|
||||||
},
|
},
|
||||||
"test1": Tree{Path: filepath.FromSlash("mnt/driveA/work/test1")},
|
"test1": {Path: filepath.FromSlash("mnt/driveA/work/test1")},
|
||||||
}},
|
}},
|
||||||
"test2": Tree{Path: filepath.FromSlash("mnt/driveA/test2")},
|
"test2": {Path: filepath.FromSlash("mnt/driveA/test2")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
|
@ -385,9 +385,9 @@ func TestTree(t *testing.T) {
|
||||||
{
|
{
|
||||||
targets: []string{"foo/work/user", "foo/work/user"},
|
targets: []string{"foo/work/user", "foo/work/user"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||||
"user": Tree{Path: filepath.FromSlash("foo/work/user")},
|
"user": {Path: filepath.FromSlash("foo/work/user")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
|
@ -395,9 +395,9 @@ func TestTree(t *testing.T) {
|
||||||
{
|
{
|
||||||
targets: []string{"./foo/work/user", "foo/work/user"},
|
targets: []string{"./foo/work/user", "foo/work/user"},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"foo": Tree{Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
"foo": {Root: ".", FileInfoPath: "foo", Nodes: map[string]Tree{
|
||||||
"work": Tree{FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
"work": {FileInfoPath: filepath.FromSlash("foo/work"), Nodes: map[string]Tree{
|
||||||
"user": Tree{Path: filepath.FromSlash("foo/work/user")},
|
"user": {Path: filepath.FromSlash("foo/work/user")},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
|
@ -406,10 +406,10 @@ func TestTree(t *testing.T) {
|
||||||
win: true,
|
win: true,
|
||||||
targets: []string{`c:\users\foobar\temp`},
|
targets: []string{`c:\users\foobar\temp`},
|
||||||
want: Tree{Nodes: map[string]Tree{
|
want: Tree{Nodes: map[string]Tree{
|
||||||
"c": Tree{Root: `c:\`, FileInfoPath: `c:\`, Nodes: map[string]Tree{
|
"c": {Root: `c:\`, FileInfoPath: `c:\`, Nodes: map[string]Tree{
|
||||||
"users": Tree{FileInfoPath: `c:\users`, Nodes: map[string]Tree{
|
"users": {FileInfoPath: `c:\users`, Nodes: map[string]Tree{
|
||||||
"foobar": Tree{FileInfoPath: `c:\users\foobar`, Nodes: map[string]Tree{
|
"foobar": {FileInfoPath: `c:\users\foobar`, Nodes: map[string]Tree{
|
||||||
"temp": Tree{Path: `c:\users\foobar\temp`},
|
"temp": {Path: `c:\users\foobar\temp`},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
"bazil.org/fuse/fs"
|
"bazil.org/fuse/fs"
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"github.com/restic/restic/internal/debug"
|
"github.com/restic/restic/internal/debug"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/debug"
|
"github.com/restic/restic/internal/debug"
|
||||||
|
@ -11,7 +12,6 @@ import (
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
"bazil.org/fuse/fs"
|
"bazil.org/fuse/fs"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// The default block size to report in stat
|
// The default block size to report in stat
|
||||||
|
|
|
@ -4,13 +4,12 @@ package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"github.com/restic/restic/internal/repository"
|
"github.com/restic/restic/internal/repository"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
"bazil.org/fuse/fs"
|
"bazil.org/fuse/fs"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Statically ensure that *link implements the given interface
|
// Statically ensure that *link implements the given interface
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/debug"
|
"github.com/restic/restic/internal/debug"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
"bazil.org/fuse/fs"
|
"bazil.org/fuse/fs"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
"golang.org/x/net/context"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type other struct {
|
type other struct {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
@ -10,8 +11,6 @@ import (
|
||||||
"github.com/restic/restic/internal/debug"
|
"github.com/restic/restic/internal/debug"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
"bazil.org/fuse/fs"
|
"bazil.org/fuse/fs"
|
||||||
)
|
)
|
||||||
|
|
|
@ -715,7 +715,7 @@ func (r *Repository) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte
|
||||||
// first try to add to pending blobs; if not successful, this blob is already known
|
// first try to add to pending blobs; if not successful, this blob is already known
|
||||||
known = !r.idx.addPending(newID, t)
|
known = !r.idx.addPending(newID, t)
|
||||||
|
|
||||||
// only save when needed or explicitely told
|
// only save when needed or explicitly told
|
||||||
if !known || storeDuplicate {
|
if !known || storeDuplicate {
|
||||||
err = r.SaveAndEncrypt(ctx, t, buf, newID)
|
err = r.SaveAndEncrypt(ctx, t, buf, newID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
//
|
//
|
||||||
// Implementation does not guarantee order in which blobs are written to the
|
// Implementation does not guarantee order in which blobs are written to the
|
||||||
// target files and, for example, the last blob of a file can be written to the
|
// target files and, for example, the last blob of a file can be written to the
|
||||||
// file before any of the preceeding file blobs. It is therefore possible to
|
// file before any of the preceding file blobs. It is therefore possible to
|
||||||
// have gaps in the data written to the target files if restore fails or
|
// have gaps in the data written to the target files if restore fails or
|
||||||
// interrupted by the user.
|
// interrupted by the user.
|
||||||
package restorer
|
package restorer
|
||||||
|
|
|
@ -244,7 +244,7 @@ func TestWalker(t *testing.T) {
|
||||||
}),
|
}),
|
||||||
checkSkipFor(
|
checkSkipFor(
|
||||||
map[string]struct{}{
|
map[string]struct{}{
|
||||||
"/subdir": struct{}{},
|
"/subdir": {},
|
||||||
}, []string{
|
}, []string{
|
||||||
"/",
|
"/",
|
||||||
"/foo",
|
"/foo",
|
||||||
|
@ -299,7 +299,7 @@ func TestWalker(t *testing.T) {
|
||||||
}),
|
}),
|
||||||
checkSkipFor(
|
checkSkipFor(
|
||||||
map[string]struct{}{
|
map[string]struct{}{
|
||||||
"/subdir1": struct{}{},
|
"/subdir1": {},
|
||||||
}, []string{
|
}, []string{
|
||||||
"/",
|
"/",
|
||||||
"/foo",
|
"/foo",
|
||||||
|
@ -312,8 +312,8 @@ func TestWalker(t *testing.T) {
|
||||||
),
|
),
|
||||||
checkSkipFor(
|
checkSkipFor(
|
||||||
map[string]struct{}{
|
map[string]struct{}{
|
||||||
"/subdir1": struct{}{},
|
"/subdir1": {},
|
||||||
"/subdir2/subsubdir2": struct{}{},
|
"/subdir2/subsubdir2": {},
|
||||||
}, []string{
|
}, []string{
|
||||||
"/",
|
"/",
|
||||||
"/foo",
|
"/foo",
|
||||||
|
@ -325,7 +325,7 @@ func TestWalker(t *testing.T) {
|
||||||
),
|
),
|
||||||
checkSkipFor(
|
checkSkipFor(
|
||||||
map[string]struct{}{
|
map[string]struct{}{
|
||||||
"/foo": struct{}{},
|
"/foo": {},
|
||||||
}, []string{
|
}, []string{
|
||||||
"/",
|
"/",
|
||||||
"/foo",
|
"/foo",
|
||||||
|
@ -390,7 +390,7 @@ func TestWalker(t *testing.T) {
|
||||||
}),
|
}),
|
||||||
checkIgnore(
|
checkIgnore(
|
||||||
map[string]struct{}{
|
map[string]struct{}{
|
||||||
"/subdir1": struct{}{},
|
"/subdir1": {},
|
||||||
}, map[string]bool{
|
}, map[string]bool{
|
||||||
"/subdir1": true,
|
"/subdir1": true,
|
||||||
}, []string{
|
}, []string{
|
||||||
|
@ -415,7 +415,7 @@ func TestWalker(t *testing.T) {
|
||||||
),
|
),
|
||||||
checkIgnore(
|
checkIgnore(
|
||||||
map[string]struct{}{
|
map[string]struct{}{
|
||||||
"/subdir2": struct{}{},
|
"/subdir2": {},
|
||||||
}, map[string]bool{
|
}, map[string]bool{
|
||||||
"/subdir2": true,
|
"/subdir2": true,
|
||||||
}, []string{
|
}, []string{
|
||||||
|
|
Loading…
Reference in a new issue