mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-15 15:53:26 +00:00
Merge e30bf3b9bc into 69f5d2f7bf
This commit is contained in:
1
go.mod
1
go.mod
@@ -15,7 +15,6 @@ require (
|
|||||||
github.com/gilbertchen/gopass v0.0.0-20170109162249-bf9dde6d0d2c
|
github.com/gilbertchen/gopass v0.0.0-20170109162249-bf9dde6d0d2c
|
||||||
github.com/gilbertchen/highwayhash v0.0.0-20221109044721-eeab1f4799d8
|
github.com/gilbertchen/highwayhash v0.0.0-20221109044721-eeab1f4799d8
|
||||||
github.com/gilbertchen/keyring v0.0.0-20221004152639-1661cbebc508
|
github.com/gilbertchen/keyring v0.0.0-20221004152639-1661cbebc508
|
||||||
github.com/gilbertchen/xattr v0.0.0-20160926155429-68e7a6806b01
|
|
||||||
github.com/hirochachacha/go-smb2 v1.1.0
|
github.com/hirochachacha/go-smb2 v1.1.0
|
||||||
github.com/klauspost/compress v1.16.3
|
github.com/klauspost/compress v1.16.3
|
||||||
github.com/klauspost/reedsolomon v1.9.9
|
github.com/klauspost/reedsolomon v1.9.9
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -47,8 +47,6 @@ github.com/gilbertchen/highwayhash v0.0.0-20221109044721-eeab1f4799d8 h1:ijgl4Y+
|
|||||||
github.com/gilbertchen/highwayhash v0.0.0-20221109044721-eeab1f4799d8/go.mod h1:0lQcVva56+L1PuUFXLOsJ6arJQaU0baIH8q+IegeBhg=
|
github.com/gilbertchen/highwayhash v0.0.0-20221109044721-eeab1f4799d8/go.mod h1:0lQcVva56+L1PuUFXLOsJ6arJQaU0baIH8q+IegeBhg=
|
||||||
github.com/gilbertchen/keyring v0.0.0-20221004152639-1661cbebc508 h1:SqTyk5KkNXp7zTdTttIZSDcTrL5uau4K/2OpKvgBZVI=
|
github.com/gilbertchen/keyring v0.0.0-20221004152639-1661cbebc508 h1:SqTyk5KkNXp7zTdTttIZSDcTrL5uau4K/2OpKvgBZVI=
|
||||||
github.com/gilbertchen/keyring v0.0.0-20221004152639-1661cbebc508/go.mod h1:w/pisxUZezf2XzU9Ewjphcf6q1mZtOzKPHhJiuc8cag=
|
github.com/gilbertchen/keyring v0.0.0-20221004152639-1661cbebc508/go.mod h1:w/pisxUZezf2XzU9Ewjphcf6q1mZtOzKPHhJiuc8cag=
|
||||||
github.com/gilbertchen/xattr v0.0.0-20160926155429-68e7a6806b01 h1:LqwS9qL6SrDkp0g0iwUkETrDdtB9gTKaIbSn9imUq5o=
|
|
||||||
github.com/gilbertchen/xattr v0.0.0-20160926155429-68e7a6806b01/go.mod h1:TMlibuxKfkdtHyltooAw7+DHqRpaXs9nxaffk00Sh1Q=
|
|
||||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||||
github.com/goamz/goamz v0.0.0-20180131231218-8b901b531db8 h1:G1U0vew/vA/1/hBmf1XNeyIzJJbPFVv+kb+HPl6rj6c=
|
github.com/goamz/goamz v0.0.0-20180131231218-8b901b531db8 h1:G1U0vew/vA/1/hBmf1XNeyIzJJbPFVv+kb+HPl6rj6c=
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
package duplicacy
|
package duplicacy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
@@ -13,10 +15,9 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/gilbertchen/xattr"
|
"github.com/pkg/xattr"
|
||||||
|
|
||||||
"github.com/vmihailenco/msgpack"
|
"github.com/vmihailenco/msgpack"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -233,8 +234,18 @@ func TestEntryOrder(t *testing.T) {
|
|||||||
// TestEntryExcludeByAttribute tests the excludeByAttribute parameter to the ListEntries function
|
// TestEntryExcludeByAttribute tests the excludeByAttribute parameter to the ListEntries function
|
||||||
func TestEntryExcludeByAttribute(t *testing.T) {
|
func TestEntryExcludeByAttribute(t *testing.T) {
|
||||||
|
|
||||||
if !(runtime.GOOS == "darwin" || runtime.GOOS == "linux") {
|
var excludeAttrName string
|
||||||
t.Skip("skipping test not darwin or linux")
|
var excludeAttrValue []byte
|
||||||
|
|
||||||
|
if runtime.GOOS == "darwin" {
|
||||||
|
excludeAttrName = "com.apple.metadata:com_apple_backup_excludeItem"
|
||||||
|
excludeAttrValue = []byte("com.apple.backupd")
|
||||||
|
} else if runtime.GOOS == "linux" {
|
||||||
|
excludeAttrName = "user.duplicacy_exclude"
|
||||||
|
} else if runtime.GOOS == "freebsd" || runtime.GOOS == "netbsd" {
|
||||||
|
excludeAttrName = "duplicacy_exclude"
|
||||||
|
} else {
|
||||||
|
t.Skip("skipping test, not darwin, linux, freebsd, or netbsd")
|
||||||
}
|
}
|
||||||
|
|
||||||
testDir := filepath.Join(os.TempDir(), "duplicacy_test")
|
testDir := filepath.Join(os.TempDir(), "duplicacy_test")
|
||||||
@@ -273,7 +284,7 @@ func TestEntryExcludeByAttribute(t *testing.T) {
|
|||||||
for _, file := range DATA {
|
for _, file := range DATA {
|
||||||
fullPath := filepath.Join(testDir, file)
|
fullPath := filepath.Join(testDir, file)
|
||||||
if strings.Contains(file, "exclude") {
|
if strings.Contains(file, "exclude") {
|
||||||
xattr.Setxattr(fullPath, "com.apple.metadata:com_apple_backup_excludeItem", []byte("com.apple.backupd"))
|
xattr.Set(fullPath, excludeAttrName, excludeAttrValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func excludedByAttribute(attirbutes map[string][]byte) bool {
|
func excludedByAttribute(attributes map[string][]byte) bool {
|
||||||
value, ok := attirbutes["com.apple.metadata:com_apple_backup_excludeItem"]
|
value, ok := attributes["com.apple.metadata:com_apple_backup_excludeItem"]
|
||||||
return ok && strings.Contains(string(value), "com.apple.backupd")
|
return ok && strings.Contains(string(value), "com.apple.backupd")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
package duplicacy
|
package duplicacy
|
||||||
|
|
||||||
import (
|
func excludedByAttribute(attributes map[string][]byte) bool {
|
||||||
)
|
_, ok := attributes["user.duplicacy_exclude"]
|
||||||
|
|
||||||
func excludedByAttribute(attirbutes map[string][]byte) bool {
|
|
||||||
_, ok := attirbutes["duplicacy_exclude"]
|
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,6 @@ func SplitDir(fullPath string) (dir string, file string) {
|
|||||||
return fullPath[:i+1], fullPath[i+1:]
|
return fullPath[:i+1], fullPath[i+1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
func excludedByAttribute(attirbutes map[string][]byte) bool {
|
func excludedByAttribute(attributes map[string][]byte) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
// Free for personal use and commercial trial
|
// Free for personal use and commercial trial
|
||||||
// Commercial use requires per-user licenses available from https://duplicacy.com
|
// Commercial use requires per-user licenses available from https://duplicacy.com
|
||||||
|
|
||||||
|
//go:build freebsd || netbsd
|
||||||
|
// +build freebsd netbsd
|
||||||
|
|
||||||
package duplicacy
|
package duplicacy
|
||||||
|
|
||||||
import (
|
func excludedByAttribute(attributes map[string][]byte) bool {
|
||||||
)
|
_, ok := attributes["duplicacy_exclude"]
|
||||||
|
|
||||||
func excludedByAttribute(attirbutes map[string][]byte) bool {
|
|
||||||
_, ok := attirbutes["duplicacy_exclude"]
|
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user