diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-24 14:24:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-24 14:24:13 -0400 |
commit | e0b543af10599f0fe382b39955e89101534d7bcb (patch) | |
tree | 5e1469dfad0ad3eeee8e3122143667ca334d30d3 /Assistant/Threads | |
parent | 8f4a33ece3651a1bdd1c4073bc0e1dcb86fa6315 (diff) |
make startup scan for deleted files work in direct mode
git add --update cannot be used, because it'll stage typechanged direct
mode files. Intead, use ls-files to find deleted files, and stage them
ourselves.
It seems that no commit was made before when the scan staged deleted files.
(Probably masked since if files were added, a commit happened then..)
Now that I'm doing the staging, I was also able to fix that bug.
Diffstat (limited to 'Assistant/Threads')
-rw-r--r-- | Assistant/Threads/Watcher.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs index f8957d25e..c0a1ea0b9 100644 --- a/Assistant/Threads/Watcher.hs +++ b/Assistant/Threads/Watcher.hs @@ -27,9 +27,10 @@ import Utility.Types.DirWatcher import Utility.Lsof import qualified Annex import qualified Annex.Queue -import qualified Git.Command +import qualified Git import qualified Git.UpdateIndex import qualified Git.HashObject +import qualified Git.LsFiles as LsFiles import qualified Backend import Annex.Content import Annex.CatFile @@ -83,9 +84,15 @@ startupScan scanner = do -- Notice any files that were deleted before -- watching was started. - liftAnnex $ do - inRepo $ Git.Command.run "add" [Param "--update"] - showAction "started" + top <- liftAnnex $ fromRepo Git.repoPath + (fs, cleanup) <- liftAnnex $ inRepo $ LsFiles.deleted [top] + forM_ fs $ \f -> do + liftAnnex $ Annex.Queue.addUpdateIndex =<< + inRepo (Git.UpdateIndex.unstageFile f) + maybe noop recordChange =<< madeChange f RmChange + void $ liftIO $ cleanup + + liftAnnex $ showAction "started" modifyDaemonStatus_ $ \s -> s { scanComplete = True } |