metadata: When setting metadata, do not recurse into directories by default, since that can be surprising behavior and difficult to recover from. The old behavior is available by using --force.
This commit is contained in:
parent
36f7e5cfdf
commit
f153079152
4 changed files with 30 additions and 1 deletions
|
@ -32,6 +32,27 @@ withFilesInGit :: (FilePath -> CommandStart) -> CommandSeek
|
||||||
withFilesInGit a params = seekActions $ prepFiltered a $
|
withFilesInGit a params = seekActions $ prepFiltered a $
|
||||||
seekHelper LsFiles.inRepo params
|
seekHelper LsFiles.inRepo params
|
||||||
|
|
||||||
|
withFilesInGitNonRecursive :: (FilePath -> CommandStart) -> CommandSeek
|
||||||
|
withFilesInGitNonRecursive a params = ifM (Annex.getState Annex.force)
|
||||||
|
( withFilesInGit a params
|
||||||
|
, if null params
|
||||||
|
then needforce
|
||||||
|
else seekActions $ prepFiltered a (getfiles [] params)
|
||||||
|
)
|
||||||
|
where
|
||||||
|
getfiles c [] = return (reverse c)
|
||||||
|
getfiles c (p:ps) = do
|
||||||
|
(fs, cleanup) <- inRepo $ LsFiles.inRepo [p]
|
||||||
|
case fs of
|
||||||
|
[f] -> do
|
||||||
|
void $ liftIO $ cleanup
|
||||||
|
getfiles (f:c) ps
|
||||||
|
[] -> do
|
||||||
|
void $ liftIO $ cleanup
|
||||||
|
getfiles c ps
|
||||||
|
_ -> needforce
|
||||||
|
needforce = error "Not recursively setting metadata. Use --force to do that."
|
||||||
|
|
||||||
withFilesNotInGit :: Bool -> (FilePath -> CommandStart) -> CommandSeek
|
withFilesNotInGit :: Bool -> (FilePath -> CommandStart) -> CommandSeek
|
||||||
withFilesNotInGit skipdotfiles a params
|
withFilesNotInGit skipdotfiles a params
|
||||||
| skipdotfiles = do
|
| skipdotfiles = do
|
||||||
|
|
|
@ -58,9 +58,12 @@ seek ps = do
|
||||||
getfield <- getOptionField getOption $ \ms ->
|
getfield <- getOptionField getOption $ \ms ->
|
||||||
return $ either error id . mkMetaField <$> ms
|
return $ either error id . mkMetaField <$> ms
|
||||||
now <- liftIO getPOSIXTime
|
now <- liftIO getPOSIXTime
|
||||||
|
let seeker = if null modmeta
|
||||||
|
then withFilesInGit
|
||||||
|
else withFilesInGitNonRecursive
|
||||||
withKeyOptions
|
withKeyOptions
|
||||||
(startKeys now getfield modmeta)
|
(startKeys now getfield modmeta)
|
||||||
(withFilesInGit (whenAnnexed $ start now getfield modmeta))
|
(seeker $ whenAnnexed $ start now getfield modmeta)
|
||||||
ps
|
ps
|
||||||
|
|
||||||
start :: POSIXTime -> Maybe MetaField -> [ModMeta] -> FilePath -> Key -> CommandStart
|
start :: POSIXTime -> Maybe MetaField -> [ModMeta] -> FilePath -> Key -> CommandStart
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -22,6 +22,9 @@ git-annex (5.20150206) UNRELEASED; urgency=medium
|
||||||
built with process-1.2
|
built with process-1.2
|
||||||
* bittorrent: Fix mojibake introduced in parsing arai2c progress output.
|
* bittorrent: Fix mojibake introduced in parsing arai2c progress output.
|
||||||
* fsck --from: If a download from a remote fails, propigate the failure.
|
* fsck --from: If a download from a remote fails, propigate the failure.
|
||||||
|
* metadata: When setting metadata, do not recurse into directories by
|
||||||
|
default, since that can be surprising behavior and difficult to recover
|
||||||
|
from. The old behavior is available by using --force.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 06 Feb 2015 13:57:08 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 06 Feb 2015 13:57:08 -0400
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,5 @@ congrats, your old values of field are (kinda) gone.
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> agreed; [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue