local: add --skip-links to suppress symlink warnings
Give users a way to explicitly acknowledge that symlinks are to be skipped without warnings. Fixes #1480.
This commit is contained in:
parent
6ae29df4d7
commit
6152bab28d
2 changed files with 9 additions and 1 deletions
|
@ -172,3 +172,8 @@ filesystem.
|
||||||
**NB** This flag is only available on Unix based systems. On systems
|
**NB** This flag is only available on Unix based systems. On systems
|
||||||
where it isn't supported (eg Windows) it will not appear as an valid
|
where it isn't supported (eg Windows) it will not appear as an valid
|
||||||
flag.
|
flag.
|
||||||
|
|
||||||
|
#### --skip-links ####
|
||||||
|
|
||||||
|
This flag disables warning messages on skipped symlinks or junction
|
||||||
|
points, as you explicitly acknowledge that they should be skipped.
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
followSymlinks = fs.BoolP("copy-links", "L", false, "Follow symlinks and copy the pointed to item.")
|
followSymlinks = fs.BoolP("copy-links", "L", false, "Follow symlinks and copy the pointed to item.")
|
||||||
|
skipSymlinks = fs.BoolP("skip-links", "", false, "Don't warn about skipped symlinks.")
|
||||||
noUTFNorm = fs.BoolP("local-no-unicode-normalization", "", false, "Don't apply unicode normalization to paths and filenames")
|
noUTFNorm = fs.BoolP("local-no-unicode-normalization", "", false, "Don't apply unicode normalization to paths and filenames")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -606,7 +607,9 @@ func (o *Object) Storable() bool {
|
||||||
mode &^= os.ModeSymlink
|
mode &^= os.ModeSymlink
|
||||||
}
|
}
|
||||||
if mode&os.ModeSymlink != 0 {
|
if mode&os.ModeSymlink != 0 {
|
||||||
fs.Logf(o, "Can't follow symlink without -L/--copy-links")
|
if !*skipSymlinks {
|
||||||
|
fs.Logf(o, "Can't follow symlink without -L/--copy-links")
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
} else if mode&(os.ModeNamedPipe|os.ModeSocket|os.ModeDevice) != 0 {
|
} else if mode&(os.ModeNamedPipe|os.ModeSocket|os.ModeDevice) != 0 {
|
||||||
fs.Logf(o, "Can't transfer non file/directory")
|
fs.Logf(o, "Can't transfer non file/directory")
|
||||||
|
|
Loading…
Add table
Reference in a new issue