summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-07-16 15:00:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-07-16 15:00:25 -0400
commitee55dd4a57a2bc7026ea56cd71a55ee73919a16f (patch)
tree3bb5138028d2d605f84267160ed80c8a3c890b20
parentb16c208e0358c883470c88456c9fa527663c1d55 (diff)
uninit: Preserve .git/annex/objects at the end, if it still has content, so that old versions of files and deleted files are not deleted. Print a message with some suggested actions.
-rw-r--r--Command/Uninit.hs23
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/git_annex_uninit_loses_content_when_interrupted.mdwn2
3 files changed, 26 insertions, 2 deletions
diff --git a/Command/Uninit.hs b/Command/Uninit.hs
index c57fff017..066440449 100644
--- a/Command/Uninit.hs
+++ b/Command/Uninit.hs
@@ -62,9 +62,28 @@ startUnannex file info = do
start :: CommandStart
start = next $ next $ do
annexdir <- fromRepo gitAnnexDir
+ annexobjectdir <- fromRepo gitAnnexObjectDir
+ present <- getKeysPresent
+ if null present
+ then liftIO $ removeDirectoryRecursive annexdir
+ else error $ unlines
+ [ "Not fully uninitialized"
+ , "Some annexed data is still left in " ++ annexobjectdir
+ , "This may include deleted files, or old versions of modified files."
+ , ""
+ , "If you don't care about preserving the data, just delete the"
+ , "directory."
+ , ""
+ , "Or, you can move it to another location, in case it turns out"
+ , "something in there is important."
+ , ""
+ , "Or, you can run `git annex unused` followed by `git annex dropunused`"
+ , "to remove data that is not used by any tag or branch, which might"
+ , "take care of all the data."
+ , ""
+ , "Then run `git annex uninit` again to finish."
+ ]
uninitialize
- mapM_ removeAnnex =<< getKeysPresent
- liftIO $ removeDirectoryRecursive annexdir
-- avoid normal shutdown
saveState False
inRepo $ Git.Command.run
diff --git a/debian/changelog b/debian/changelog
index 9cbe2d692..b44931ee6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ git-annex (4.20130710) UNRELEASED; urgency=low
* Rsync.net have committed to support git-annex and offer a special
discounted rate for git-annex users. Updated the webapp to reflect this.
http://www.rsync.net/products/git-annex-pricing.html
+ * uninit: Preserve .git/annex/objects at the end, if it still
+ has content, so that old versions of files and deleted files
+ are not deleted. Print a message with some suggested actions.
-- Joey Hess <joeyh@debian.org> Tue, 09 Jul 2013 19:17:13 -0400
diff --git a/doc/bugs/git_annex_uninit_loses_content_when_interrupted.mdwn b/doc/bugs/git_annex_uninit_loses_content_when_interrupted.mdwn
index d5afa0064..e7698883f 100644
--- a/doc/bugs/git_annex_uninit_loses_content_when_interrupted.mdwn
+++ b/doc/bugs/git_annex_uninit_loses_content_when_interrupted.mdwn
@@ -29,3 +29,5 @@ Ctrl-C
# End of transcript or log.
"""]]
+
+> [[done]]; see my comment --[[Joey]]