mirror of
https://github.com/rclone/rclone
synced 2024-11-25 02:47:14 +01:00
local: make using -l/--links with -L/--copy-links throw an error #1152
This commit is contained in:
parent
65ff330602
commit
e317f04098
@ -142,6 +142,8 @@ type Object struct {
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
var errLinksAndCopyLinks = errors.New("can't use -l/--links with -L/--copy-links")
|
||||
|
||||
// NewFs constructs an Fs from the path
|
||||
func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||
// Parse config into Options struct
|
||||
@ -150,6 +152,9 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if opt.TranslateSymlinks && opt.FollowSymlinks {
|
||||
return nil, errLinksAndCopyLinks
|
||||
}
|
||||
|
||||
if opt.NoUTFNorm {
|
||||
fs.Errorf(nil, "The --local-no-unicode-normalization flag is deprecated and will be removed")
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/ncw/rclone/fs/config/configmap"
|
||||
"github.com/ncw/rclone/fs/hash"
|
||||
"github.com/ncw/rclone/fstest"
|
||||
"github.com/ncw/rclone/lib/file"
|
||||
@ -164,3 +165,12 @@ func TestSymlink(t *testing.T) {
|
||||
require.Equal(t, "file.txt"[2:5+1], string(contents))
|
||||
require.NoError(t, in.Close())
|
||||
}
|
||||
|
||||
func TestSymlinkError(t *testing.T) {
|
||||
m := configmap.Simple{
|
||||
"links": "true",
|
||||
"copy_links": "true",
|
||||
}
|
||||
_, err := NewFs("local", "/", m)
|
||||
assert.Equal(t, errLinksAndCopyLinks, err)
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ Normally rclone will ignore symlinks or junction points (which behave
|
||||
like symlinks under Windows).
|
||||
|
||||
If you supply `--copy-links` or `-L` then rclone will follow the
|
||||
symlink and copy the pointed to file or directory.
|
||||
symlink and copy the pointed to file or directory. Note that this
|
||||
flag is incompatible with `-links` / `-l`.
|
||||
|
||||
This flag applies to all commands.
|
||||
|
||||
@ -121,10 +122,10 @@ $ rclone -L ls /tmp/a
|
||||
Normally rclone will ignore symlinks or junction points (which behave
|
||||
like symlinks under Windows).
|
||||
|
||||
If you supply this flag then rclone will copy symblic links from the local storage,
|
||||
If you supply this flag then rclone will copy symbolic links from the local storage,
|
||||
and store them as text files, with a '.rclonelink' suffix in the remote storage.
|
||||
|
||||
The text file will contain the target of the symblic link (see example).
|
||||
The text file will contain the target of the symbolic link (see example).
|
||||
|
||||
This flag applies to all commands.
|
||||
|
||||
@ -151,7 +152,7 @@ $ rclone ls remote:/tmp/a
|
||||
14 file2.rclonelink
|
||||
```
|
||||
|
||||
The remote files will contain the target of the symblic links
|
||||
The remote files will contain the target of the symbolic links
|
||||
|
||||
```
|
||||
$ rclone cat remote:/tmp/a/file1.rclonelink
|
||||
@ -183,7 +184,10 @@ $ tree /tmp/b
|
||||
└── file2.rclonelink
|
||||
````
|
||||
|
||||
Note that this flag is incompatible with `-copy-links` / `-L`.
|
||||
|
||||
### Restricting filesystems with --one-file-system
|
||||
|
||||
Normally rclone will recurse through filesystems as mounted.
|
||||
|
||||
However if you set `--one-file-system` or `-x` this tells rclone to
|
||||
|
Loading…
Reference in New Issue
Block a user