* Miscellaneous tweaks and fixes
Mostly these were found by running golangci-lint with a bunch of linters
(more than the default set) enabled.
* fmt.Fprint -> fmt.Fprintln where possible
* Remove "nolint:staticcheck" for now
* Use 32KB buffer for `copyFile()` (reduces copy time by 30%)
This makes `:paste` comparable in performance to `cp --reflink=never`
for large files.
For large number of small files improvements are less substantial
(compared to `cp -r --reflink=never`), though still noticeable.
In both cases the copy takes about 30% less time than with `buf` size at 4096.
32KB is the same number `io.Copy()` uses internally (when it can), and is about where improvements stop.
Context:
https://github.com/gokcehan/lf/issues/1685#issuecomment-2163934296
* Apply suggested changes
* Just delete incomplete an file on all errors
* Mention new progress UI update frequency
* Return the old (each 4MB copied) progress update frequency
(progress UI updates don't seem to impact performance much)
* make it possible to preserve mtime and atime when copying files
Preserving other attributes like ownership, ctime or btime of a file is
desired but currently not possible to implement in a portable way with go.
Fixes#869
Relates to #779
* FIXUP use cp-compatible default for not-preserving mode
* Fix replace dialog for symlinks
If the oldPath is a symlink to the newPath or vice versa, than os.Stat()
would resolve this symlink, and both the oldStat and newStat would be
the same. Hence, the replace dialog would not appear and the newPath
file would be overwritten by the oldPath file whilst the oldPath would
be deleted.
It is the same story when the oldPath and newPath are both symlinks to
the same file.
* Fix completion in the case of broken symlinks
If the current directory contains broken symlinks then matchFile() would
return at first broken symlink.
Let's consider the following example:
$ ls -F ~/
broken@ dir/ file
The broken@ is a symlink to ~/foo - non existent file.
If one would enter the following command in lf:
:cd ~/<tab>
it would not suggest possible completion options because matchFile()
would return as soon as it meet the broken symlink.
* Don't resolve symlinks when move files/dirs (#571)
This will allow to move broken symlinks.
* Fix symlinks copying/moving (#571)
Copy symlinks, do not try to resolve it and copy the file pointed by
this symlink. Also this allows to copy symlink to directory.