diff options
-rw-r--r-- | Assistant/Threads/SanityChecker.hs | 4 | ||||
-rw-r--r-- | Assistant/Threads/Watcher.hs | 8 | ||||
-rw-r--r-- | debian/changelog | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs index 906167ca8..a6166214a 100644 --- a/Assistant/Threads/SanityChecker.hs +++ b/Assistant/Threads/SanityChecker.hs @@ -19,6 +19,7 @@ import qualified Git.Config import Utility.ThreadScheduler import qualified Assistant.Threads.Watcher as Watcher import Utility.LogFile +import Config import Data.Time.Clock.POSIX @@ -105,7 +106,8 @@ dailyCheck = do liftAnnex $ warning msg void $ addAlert $ sanityCheckFixAlert msg addsymlink file s = do - Watcher.runHandler Watcher.onAddSymlink file s + isdirect <- liftAnnex isDirect + Watcher.runHandler (Watcher.onAddSymlink isdirect) file s insanity $ "found unstaged symlink: " ++ file hourlyCheck :: Assistant () diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs index 7e373e95a..4eac622f9 100644 --- a/Assistant/Threads/Watcher.hs +++ b/Assistant/Threads/Watcher.hs @@ -82,7 +82,7 @@ runWatcher = do direct <- liftAnnex isDirect addhook <- hook $ if direct then onAddDirect else onAdd delhook <- hook onDel - addsymlinkhook <- hook onAddSymlink + addsymlinkhook <- hook $ onAddSymlink direct deldirhook <- hook onDelDir errhook <- hook onErr let hooks = mkWatchHooks @@ -193,10 +193,12 @@ onAddDirect file fs = do - Or, if it is a git-annex symlink, ensure it points to the content - before adding it. -} -onAddSymlink :: Handler -onAddSymlink file filestatus = go =<< liftAnnex (Backend.lookupFile file) +onAddSymlink :: Bool -> Handler +onAddSymlink isdirect file filestatus = go =<< liftAnnex (Backend.lookupFile file) where go (Just (key, _)) = do + when isdirect $ + liftAnnex $ void $ addAssociatedFile key file link <- liftAnnex $ calcGitLink file key ifM ((==) (Just link) <$> liftIO (catchMaybeIO $ readSymbolicLink file)) ( do diff --git a/debian/changelog b/debian/changelog index a241d4bfc..791f59ebd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,9 @@ git-annex (4.20130228) UNRELEASED; urgency=low very non-aggressively. * webapp: New preferences page allows enabling/disabling debug logging at runtime, as well as configuring numcopies and diskreserve. + * assistant: Fix bug in direct mode that could occur when a symlink is + moved out of an archive directory, and resulted in the file not being + set to direct mode when it was transferred. -- Joey Hess <joeyh@debian.org> Wed, 27 Feb 2013 23:20:40 -0400 |