Skip to content

Commit 6a6162d

Browse files
arp242jakubno
authored andcommitted
Remove NoFollow
Remove NoFollow added in fsnotify#631 / 53b06a8, as it's not really possible to implement this correctly on all kqueue platforms.
1 parent d998e18 commit 6a6162d

File tree

6 files changed

+1
-98
lines changed

6 files changed

+1
-98
lines changed

backend_inotify.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ func (w *inotify) AddWith(path string, opts ...addOpt) error {
193193

194194
add := func(path string, with withOpts, wf watchFlag) error {
195195
var flags uint32
196-
if with.noFollow {
197-
flags |= unix.IN_DONT_FOLLOW
198-
}
199196
if with.op.Has(Create) {
200197
flags |= unix.IN_CREATE
201198
}

fsnotify.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ type (
410410
withOpts struct {
411411
bufsize int
412412
op Op
413-
noFollow bool
414413
sendCreate bool
415414
}
416415
)
@@ -469,12 +468,6 @@ func withOps(op Op) addOpt {
469468
return func(opt *withOpts) { opt.op = op }
470469
}
471470

472-
// WithNoFollow disables following symlinks, so the symlinks themselves are
473-
// watched.
474-
func withNoFollow() addOpt {
475-
return func(opt *withOpts) { opt.noFollow = true }
476-
}
477-
478471
// "Internal" option for recursive watches on inotify.
479472
func withCreate() addOpt {
480473
return func(opt *withOpts) { opt.sendCreate = true }

helpers_test.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -671,15 +671,6 @@ func supportsRename() bool {
671671
}
672672
}
673673

674-
func supportsNofollow(t *testing.T) {
675-
switch runtime.GOOS {
676-
case "linux":
677-
// Run test.
678-
default:
679-
t.Skip("withNoFollow() not yet supported on " + runtime.GOOS)
680-
}
681-
}
682-
683674
func tmppath(tmp, s string) string {
684675
if len(s) == 0 {
685676
return ""
@@ -823,8 +814,6 @@ loop:
823814
supportsRecurse(t)
824815
case "filter":
825816
supportsFilter(t)
826-
case "nofollow":
827-
supportsNofollow(t)
828817
case "windows":
829818
if runtime.GOOS == "windows" {
830819
t.Skip("Skipping on Windows")
@@ -871,15 +860,6 @@ loop:
871860
continue
872861
}
873862

874-
var follow addOpt
875-
for i := range c.args {
876-
if c.args[i] == "nofollow" || c.args[i] == "no-follow" {
877-
c.args = append(c.args[:i], c.args[i+1:]...)
878-
follow = withNoFollow()
879-
break
880-
}
881-
}
882-
883863
var op Op
884864
for _, o := range c.args[1:] {
885865
switch strings.ToLower(o) {
@@ -909,7 +889,7 @@ loop:
909889
}
910890
do = append(do, func() {
911891
p := tmppath(tmp, c.args[0])
912-
err := w.w.AddWith(p, withOps(op), follow)
892+
err := w.w.AddWith(p, withOps(op))
913893
if err != nil {
914894
t.Fatalf("line %d: addWatch(%q): %s", c.line+1, p, err)
915895
}

testdata/watch-dir/symlink-nofollow

Lines changed: 0 additions & 30 deletions
This file was deleted.

testdata/watch-symlink/nofollow-dir

Lines changed: 0 additions & 17 deletions
This file was deleted.

testdata/watch-symlink/nofollow-file

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)