unannex: In --fast mode, file content is left in the annex, and a hard link made to it.

This commit is contained in:
Joey Hess 2011-07-04 16:06:28 -04:00
parent 5beb6bc76f
commit 22a4f5b348
3 changed files with 16 additions and 2 deletions

View file

@ -10,6 +10,7 @@ module Command.Unannex where
import Control.Monad.State (liftIO) import Control.Monad.State (liftIO)
import Control.Monad (unless) import Control.Monad (unless)
import System.Directory import System.Directory
import System.Posix.Files
import Command import Command
import qualified Annex import qualified Annex
@ -22,6 +23,7 @@ import Content
import qualified Git import qualified Git
import qualified Git.LsFiles as LsFiles import qualified Git.LsFiles as LsFiles
import Messages import Messages
import Locations
command :: [Command] command :: [Command]
command = [repoCommand "unannex" paramPath seek "undo accidential add command"] command = [repoCommand "unannex" paramPath seek "undo accidential add command"]
@ -64,6 +66,13 @@ cleanup file key = do
-- git rm deletes empty directories; put them back -- git rm deletes empty directories; put them back
liftIO $ createDirectoryIfMissing True (parentDir file) liftIO $ createDirectoryIfMissing True (parentDir file)
fast <- Annex.getState Annex.fast
if fast
then liftIO $ do
-- fast mode: hard link to content in annex
createLink (gitAnnexLocation g key) file
allowWrite file
else do
fromAnnex key file fromAnnex key file
logStatus key InfoMissing logStatus key InfoMissing

2
debian/changelog vendored
View file

@ -1,6 +1,8 @@
git-annex (3.20110703) UNRELEASED; urgency=low git-annex (3.20110703) UNRELEASED; urgency=low
* uninit: Delete the git-annex branch and .git/annex/ * uninit: Delete the git-annex branch and .git/annex/
* unannex: In --fast mode, file content is left in the annex, and a
hard link made to it.
-- Joey Hess <joeyh@debian.org> Mon, 04 Jul 2011 15:50:21 -0400 -- Joey Hess <joeyh@debian.org> Mon, 04 Jul 2011 15:50:21 -0400

View file

@ -239,6 +239,9 @@ Many git-annex commands will stage changes for later `git commit` by you.
file and don't want its contents any more. In that case you should use file and don't want its contents any more. In that case you should use
`git annex drop` instead, and you can also `git rm` the file. `git annex drop` instead, and you can also `git rm` the file.
In --fast mode, this command leaves content in the annex, simply making
a hard link to it.
* uninit * uninit
Use this to stop using git annex. It will unannex every file in the Use this to stop using git annex. It will unannex every file in the