@@ -669,6 +669,15 @@ func supportsRename() bool {
669669 }
670670}
671671
672+ func supportsNofollow (t * testing.T ) {
673+ switch runtime .GOOS {
674+ case "linux" :
675+ // Run test.
676+ default :
677+ t .Skip ("withNoFollow() not yet supported on " + runtime .GOOS )
678+ }
679+ }
680+
672681func tmppath (tmp , s string ) string {
673682 if len (s ) == 0 {
674683 return ""
@@ -812,6 +821,8 @@ loop:
812821 supportsRecurse (t )
813822 case "filter" :
814823 supportsFilter (t )
824+ case "nofollow" :
825+ supportsNofollow (t )
815826 case "windows" :
816827 if runtime .GOOS == "windows" {
817828 t .Skip ("Skipping on Windows" )
@@ -852,6 +863,16 @@ loop:
852863 do = append (do , func () { addWatch (t , w .w , tmppath (tmp , c .args [0 ])) })
853864 continue
854865 }
866+
867+ var follow addOpt
868+ for i := range c .args {
869+ if c .args [i ] == "nofollow" || c .args [i ] == "no-follow" {
870+ c .args = append (c .args [:i ], c .args [i + 1 :]... )
871+ follow = withNoFollow ()
872+ break
873+ }
874+ }
875+
855876 var op Op
856877 for _ , o := range c .args [1 :] {
857878 switch strings .ToLower (o ) {
@@ -878,11 +899,10 @@ loop:
878899 case "close_read" :
879900 op |= xUnportableCloseRead
880901 }
881-
882902 }
883903 do = append (do , func () {
884904 p := tmppath (tmp , c .args [0 ])
885- err := w .w .AddWith (p , withOps (op ))
905+ err := w .w .AddWith (p , withOps (op ), follow )
886906 if err != nil {
887907 t .Fatalf ("line %d: addWatch(%q): %s" , c .line + 1 , p , err )
888908 }
0 commit comments