summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-04 16:19:04 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-04 16:20:50 -0400
commit71c783bf24f2aa4ab911d8279081bcad08951ece (patch)
treeeaf1b3aee26c76a2038c9084c0ef045a6acb317b
parentd7ce51af5abd5c8582a31c39c3968597f5cae34e (diff)
uninit: Use unannex in --fast mode, to support unannexing multiple files that link to the same content.
-rw-r--r--Command/Uninit.hs20
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/annex_unannex__47__uninit_should_handle_copies.mdwn2
3 files changed, 18 insertions, 6 deletions
diff --git a/Command/Uninit.hs b/Command/Uninit.hs
index 5cb66e83a..1497bbfd1 100644
--- a/Command/Uninit.hs
+++ b/Command/Uninit.hs
@@ -28,7 +28,15 @@ command = [repoCommand "uninit" paramPath seek
"de-initialize git-annex and clean out repository"]
seek :: [CommandSeek]
-seek = [withFilesInGit Command.Unannex.start, withNothing start]
+seek = [withFilesInGit startUnannex, withNothing start]
+
+startUnannex :: CommandStartString
+startUnannex file = do
+ -- Force fast mode before running unannex. This way, if multiple
+ -- files link to a key, it will be left in the annex and hardlinked
+ -- to by each.
+ Annex.changeState $ \s -> s { Annex.fast = True }
+ Command.Unannex.start file
start :: CommandStartNothing
start = next perform
@@ -40,12 +48,12 @@ cleanup :: CommandCleanup
cleanup = do
g <- Annex.gitRepo
gitPreCommitHookUnWrite g
+ mapM_ removeAnnex =<< getKeysPresent
+ liftIO $ removeDirectoryRecursive (gitAnnexDir g)
+ -- avoid normal shutdown
saveState
- liftIO $ do
- Git.run g "branch" [Param "-D", Param Branch.name]
- removeDirectoryRecursive (gitAnnexDir g)
- -- avoid normal shutdown
- exitSuccess
+ liftIO $ Git.run g "branch" [Param "-D", Param Branch.name]
+ liftIO $ exitSuccess
gitPreCommitHookUnWrite :: Git.Repo -> Annex ()
gitPreCommitHookUnWrite repo = do
diff --git a/debian/changelog b/debian/changelog
index 844c6c3ad..8f559bb02 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,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.
+ * uninit: Use unannex in --fast mode, to support unannexing multiple
+ files that link to the same content.
-- Joey Hess <joeyh@debian.org> Mon, 04 Jul 2011 15:50:21 -0400
diff --git a/doc/bugs/annex_unannex__47__uninit_should_handle_copies.mdwn b/doc/bugs/annex_unannex__47__uninit_should_handle_copies.mdwn
index 751e1afa9..e830f1156 100644
--- a/doc/bugs/annex_unannex__47__uninit_should_handle_copies.mdwn
+++ b/doc/bugs/annex_unannex__47__uninit_should_handle_copies.mdwn
@@ -16,3 +16,5 @@ Rafaƫl
> `dropunused` to actually remove the content. While doable, by use case
> for unannex is more to quickly undo a mistaken add, and it's unlikely there
> are multiple symlinks to the same content in this situation. --[[Joey]]
+
+[[!tag done]]