import: Let --force overwrite symlinks, not only regular files

The docs already implied this should work.
This commit is contained in:
Joey Hess 2019-03-18 16:40:15 -04:00
parent 572a340fc5
commit 5ab97333e4
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 9 additions and 1 deletions

View file

@ -34,6 +34,7 @@ git-annex (7.20190220) UNRELEASED; urgency=medium
* Removed bundled gpg from the Linux standalone build and OSX dmg,
because gpg now always wants to use gpg-agent, and shipping such a daemon
in those is not a good idea.
* import: Let --force overwrite symlinks, not only regular files.
-- Joey Hess <id@joeyh.name> Wed, 20 Feb 2019 14:20:59 -0400

View file

@ -146,7 +146,12 @@ startLocal largematcher mode (srcfile, destfile) =
Nothing -> importfilechecked ld k
Just s
| isDirectory s -> notoverwriting "(is a directory)"
| isSymbolicLink s -> notoverwriting "(is a symlink)"
| isSymbolicLink s -> ifM (Annex.getState Annex.force)
( do
liftIO $ nukeFile destfile
importfilechecked ld k
, notoverwriting "(is a symlink)"
)
| otherwise -> ifM (Annex.getState Annex.force)
( do
liftIO $ nukeFile destfile

View file

@ -1 +1,3 @@
`git-annex import --force` does not work on locked files (only unlocked files). Running `7.20181106-g352f88226` on macOS 10.12.6
> Nicely spotted! [[fixed|done]] --[[Joey]]