Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. --- ./fs/config.go.orig-20161020L15391476985179 2016-10-20 15:09:10.083157088 -0200
  2. +++ ./fs/config.go 2016-10-20 15:45:39.618220137 -0200
  3. @@ -88,6 +88,7 @@
  4. ignoreSize = pflag.BoolP("ignore-size", "", false, "Ignore size when skipping use mod-time or checksum.")
  5. noTraverse = pflag.BoolP("no-traverse", "", false, "Don't traverse destination file system on copy.")
  6. noUpdateModTime = pflag.BoolP("no-update-modtime", "", false, "Don't update destination mod-time if files identical.")
  7. + oneFileSystem = pflag.BoolP("one-file-system", "x", false, "Don't cross filesystem boundaries.")
  8. bwLimit SizeSuffix
  9.  
  10. // Key to use for password en/decryption.
  11. @@ -299,6 +300,7 @@
  12. IgnoreSize bool
  13. NoTraverse bool
  14. NoUpdateModTime bool
  15. + OneFileSystem bool // Don't cross filesystem boundaries
  16. }
  17.  
  18. // Find the config directory
  19. @@ -349,6 +351,7 @@
  20. Config.IgnoreSize = *ignoreSize
  21. Config.NoTraverse = *noTraverse
  22. Config.NoUpdateModTime = *noUpdateModTime
  23. + Config.OneFileSystem = *oneFileSystem
  24.  
  25. ConfigPath = *configFile
  26.  
  27. --- ./local/local.go.orig-20161020L17571476993439 2016-10-20 17:57:19.191661516 -0200
  28. +++ ./local/local.go 2016-10-20 18:10:44.782492929 -0200
  29. @@ -19,6 +19,8 @@
  30.  
  31. "github.com/ncw/rclone/fs"
  32. "github.com/pkg/errors"
  33. +
  34. + "syscall"
  35. )
  36.  
  37. // Register with Fs
  38. @@ -146,11 +148,23 @@
  39. // list traverses the directory passed in, listing to out.
  40. // it returns a boolean whether it is finished or not.
  41. func (f *Fs) list(out fs.ListOpts, remote string, dirpath string, level int) (subdirs []listArgs) {
  42. + var fdFi os.FileInfo
  43. + var fdDev uint64
  44. +
  45. fd, err := os.Open(dirpath)
  46. if err != nil {
  47. out.SetError(errors.Wrapf(err, "failed to open directory %q", dirpath))
  48. return nil
  49. }
  50. +
  51. + // Obtain dirpath's device
  52. + fdFi, err = os.Stat(dirpath)
  53. + if err != nil {
  54. + out.SetError(errors.Wrapf(err, "failed to stat directory %q", dirpath))
  55. + return nil
  56. + }
  57. + fdDev = fdFi.Sys().(*syscall.Stat_t).Dev
  58. +
  59. defer func() {
  60. err := fd.Close()
  61. if err != nil {
  62. @@ -186,7 +200,8 @@
  63. if out.AddDir(dir) {
  64. return nil
  65. }
  66. - if level > 0 {
  67. + fs.Debug(f, "fs.Config.OneFileSystem=", fs.Config.OneFileSystem)
  68. + if level > 0 && ! (fs.Config.OneFileSystem && ! ((fi.Sys().(*syscall.Stat_t)).Dev == fdDev )) {
  69. subdirs = append(subdirs, listArgs{remote: newRemote, dirpath: newPath, level: level - 1})
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement