mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-24 07:28:27 +00:00
Remove followSymlinks option (ref #92)
This commit is contained in:
parent
d3915b8dbf
commit
8dee10ba9c
@ -33,7 +33,6 @@ type NodeConfiguration struct {
|
|||||||
type OptionsConfiguration struct {
|
type OptionsConfiguration struct {
|
||||||
ListenAddress []string `xml:"listenAddress" default:":22000" ini:"listen-address"`
|
ListenAddress []string `xml:"listenAddress" default:":22000" ini:"listen-address"`
|
||||||
ReadOnly bool `xml:"readOnly" ini:"read-only"`
|
ReadOnly bool `xml:"readOnly" ini:"read-only"`
|
||||||
FollowSymlinks bool `xml:"followSymlinks" default:"true" ini:"follow-symlinks"`
|
|
||||||
GUIEnabled bool `xml:"guiEnabled" default:"true" ini:"gui-enabled"`
|
GUIEnabled bool `xml:"guiEnabled" default:"true" ini:"gui-enabled"`
|
||||||
GUIAddress string `xml:"guiAddress" default:"127.0.0.1:8080" ini:"gui-address"`
|
GUIAddress string `xml:"guiAddress" default:"127.0.0.1:8080" ini:"gui-address"`
|
||||||
GlobalAnnServer string `xml:"globalAnnounceServer" default:"announce.syncthing.net:22025" ini:"global-announce-server"`
|
GlobalAnnServer string `xml:"globalAnnounceServer" default:"announce.syncthing.net:22025" ini:"global-announce-server"`
|
||||||
|
@ -11,7 +11,6 @@ func TestDefaultValues(t *testing.T) {
|
|||||||
expected := OptionsConfiguration{
|
expected := OptionsConfiguration{
|
||||||
ListenAddress: []string{":22000"},
|
ListenAddress: []string{":22000"},
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
FollowSymlinks: true,
|
|
||||||
GUIEnabled: true,
|
GUIEnabled: true,
|
||||||
GUIAddress: "127.0.0.1:8080",
|
GUIAddress: "127.0.0.1:8080",
|
||||||
GlobalAnnServer: "announce.syncthing.net:22025",
|
GlobalAnnServer: "announce.syncthing.net:22025",
|
||||||
@ -70,7 +69,6 @@ func TestOverriddenValues(t *testing.T) {
|
|||||||
<listenAddress>:23000</listenAddress>
|
<listenAddress>:23000</listenAddress>
|
||||||
<readOnly>true</readOnly>
|
<readOnly>true</readOnly>
|
||||||
<allowDelete>false</allowDelete>
|
<allowDelete>false</allowDelete>
|
||||||
<followSymlinks>false</followSymlinks>
|
|
||||||
<guiEnabled>false</guiEnabled>
|
<guiEnabled>false</guiEnabled>
|
||||||
<guiAddress>125.2.2.2:8080</guiAddress>
|
<guiAddress>125.2.2.2:8080</guiAddress>
|
||||||
<globalAnnounceServer>syncthing.nym.se:22025</globalAnnounceServer>
|
<globalAnnounceServer>syncthing.nym.se:22025</globalAnnounceServer>
|
||||||
@ -89,7 +87,6 @@ func TestOverriddenValues(t *testing.T) {
|
|||||||
expected := OptionsConfiguration{
|
expected := OptionsConfiguration{
|
||||||
ListenAddress: []string{":23000"},
|
ListenAddress: []string{":23000"},
|
||||||
ReadOnly: true,
|
ReadOnly: true,
|
||||||
FollowSymlinks: false,
|
|
||||||
GUIEnabled: false,
|
GUIEnabled: false,
|
||||||
GUIAddress: "125.2.2.2:8080",
|
GUIAddress: "125.2.2.2:8080",
|
||||||
GlobalAnnServer: "syncthing.nym.se:22025",
|
GlobalAnnServer: "syncthing.nym.se:22025",
|
||||||
|
@ -557,7 +557,6 @@ func (m *Model) ScanRepo(repo string) {
|
|||||||
w := &scanner.Walker{
|
w := &scanner.Walker{
|
||||||
Dir: m.repoDirs[repo],
|
Dir: m.repoDirs[repo],
|
||||||
IgnoreFile: ".stignore",
|
IgnoreFile: ".stignore",
|
||||||
FollowSymlinks: cfg.Options.FollowSymlinks,
|
|
||||||
BlockSize: BlockSize,
|
BlockSize: BlockSize,
|
||||||
TempNamer: defTempNamer,
|
TempNamer: defTempNamer,
|
||||||
Suppressor: sup,
|
Suppressor: sup,
|
||||||
|
@ -16,9 +16,6 @@ import (
|
|||||||
type Walker struct {
|
type Walker struct {
|
||||||
// Dir is the base directory for the walk
|
// Dir is the base directory for the walk
|
||||||
Dir string
|
Dir string
|
||||||
// If FollowSymlinks is true, symbolic links directly under Dir will be followed.
|
|
||||||
// Symbolic links at deeper levels are never followed regardless of this flag.
|
|
||||||
FollowSymlinks bool
|
|
||||||
// BlockSize controls the size of the block used when hashing.
|
// BlockSize controls the size of the block used when hashing.
|
||||||
BlockSize int
|
BlockSize int
|
||||||
// If IgnoreFile is not empty, it is the name used for the file that holds ignore patterns.
|
// If IgnoreFile is not empty, it is the name used for the file that holds ignore patterns.
|
||||||
@ -58,7 +55,7 @@ func (w *Walker) Walk() (files []File, ignore map[string][]string) {
|
|||||||
w.lazyInit()
|
w.lazyInit()
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
dlog.Println("Walk", w.Dir, w.FollowSymlinks, w.BlockSize, w.IgnoreFile)
|
dlog.Println("Walk", w.Dir, w.BlockSize, w.IgnoreFile)
|
||||||
}
|
}
|
||||||
t0 := time.Now()
|
t0 := time.Now()
|
||||||
|
|
||||||
@ -68,27 +65,6 @@ func (w *Walker) Walk() (files []File, ignore map[string][]string) {
|
|||||||
filepath.Walk(w.Dir, w.loadIgnoreFiles(w.Dir, ignore))
|
filepath.Walk(w.Dir, w.loadIgnoreFiles(w.Dir, ignore))
|
||||||
filepath.Walk(w.Dir, hashFiles)
|
filepath.Walk(w.Dir, hashFiles)
|
||||||
|
|
||||||
if w.FollowSymlinks {
|
|
||||||
d, err := os.Open(w.Dir)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer d.Close()
|
|
||||||
|
|
||||||
fis, err := d.Readdir(-1)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, info := range fis {
|
|
||||||
if info.Mode()&os.ModeSymlink != 0 {
|
|
||||||
dir := filepath.Join(w.Dir, info.Name()) + "/"
|
|
||||||
filepath.Walk(dir, w.loadIgnoreFiles(dir, ignore))
|
|
||||||
filepath.Walk(dir, hashFiles)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
t1 := time.Now()
|
t1 := time.Now()
|
||||||
d := t1.Sub(t0).Seconds()
|
d := t1.Sub(t0).Seconds()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user