summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-04 16:06:28 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-04 16:06:28 -0400
commit22a4f5b348c72a07fac99786613f6efc2eeb3b17 (patch)
tree7869cbb571564f13d884c10f4778d818aae7daf0
parent5beb6bc76fb3edbc28c238eb9596fc828aa49bfc (diff)
unannex: In --fast mode, file content is left in the annex, and a hard link made to it.
-rw-r--r--Command/Unannex.hs13
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn3
3 files changed, 16 insertions, 2 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index d30f8d20f..f0c1b27c6 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -10,6 +10,7 @@ module Command.Unannex where
import Control.Monad.State (liftIO)
import Control.Monad (unless)
import System.Directory
+import System.Posix.Files
import Command
import qualified Annex
@@ -22,6 +23,7 @@ import Content
import qualified Git
import qualified Git.LsFiles as LsFiles
import Messages
+import Locations
command :: [Command]
command = [repoCommand "unannex" paramPath seek "undo accidential add command"]
@@ -64,8 +66,15 @@ cleanup file key = do
-- git rm deletes empty directories; put them back
liftIO $ createDirectoryIfMissing True (parentDir file)
- fromAnnex key file
- logStatus key InfoMissing
+ 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
+ logStatus key InfoMissing
-- Commit staged changes at end to avoid confusing the
-- pre-commit hook if this file is later added back to
diff --git a/debian/changelog b/debian/changelog
index 3564acd17..844c6c3ad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
git-annex (3.20110703) UNRELEASED; urgency=low
* 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
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index c45088748..dfb23f5f2 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -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
`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
Use this to stop using git annex. It will unannex every file in the