summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CmdLine/Seek.hs21
-rw-r--r--Command/MetaData.hs5
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/__34__git_annex_metadata__34___without_a_file_name_is_hazardous.mdwn2
4 files changed, 30 insertions, 1 deletions
diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs
index 2fe217703..7bfea45d0 100644
--- a/CmdLine/Seek.hs
+++ b/CmdLine/Seek.hs
@@ -32,6 +32,27 @@ withFilesInGit :: (FilePath -> CommandStart) -> CommandSeek
withFilesInGit a params = seekActions $ prepFiltered a $
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 skipdotfiles a params
| skipdotfiles = do
diff --git a/Command/MetaData.hs b/Command/MetaData.hs
index a16f4214a..f1de6b6de 100644
--- a/Command/MetaData.hs
+++ b/Command/MetaData.hs
@@ -58,9 +58,12 @@ seek ps = do
getfield <- getOptionField getOption $ \ms ->
return $ either error id . mkMetaField <$> ms
now <- liftIO getPOSIXTime
+ let seeker = if null modmeta
+ then withFilesInGit
+ else withFilesInGitNonRecursive
withKeyOptions
(startKeys now getfield modmeta)
- (withFilesInGit (whenAnnexed $ start now getfield modmeta))
+ (seeker $ whenAnnexed $ start now getfield modmeta)
ps
start :: POSIXTime -> Maybe MetaField -> [ModMeta] -> FilePath -> Key -> CommandStart
diff --git a/debian/changelog b/debian/changelog
index ed503530b..5ae18df12 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,6 +22,9 @@ git-annex (5.20150206) UNRELEASED; urgency=medium
built with process-1.2
* bittorrent: Fix mojibake introduced in parsing arai2c progress output.
* 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
diff --git a/doc/bugs/__34__git_annex_metadata__34___without_a_file_name_is_hazardous.mdwn b/doc/bugs/__34__git_annex_metadata__34___without_a_file_name_is_hazardous.mdwn
index 1a93b4b5b..44644c890 100644
--- a/doc/bugs/__34__git_annex_metadata__34___without_a_file_name_is_hazardous.mdwn
+++ b/doc/bugs/__34__git_annex_metadata__34___without_a_file_name_is_hazardous.mdwn
@@ -22,3 +22,5 @@ congrats, your old values of field are (kinda) gone.
# End of transcript or log.
"""]]
+
+> agreed; [[fixed|done]] --[[Joey]]