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.

This commit is contained in:
Joey Hess 2013-07-16 15:00:25 -04:00
parent 57830554c0
commit 1d7d3ac325
3 changed files with 26 additions and 2 deletions

View file

@ -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

3
debian/changelog vendored
View file

@ -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

View file

@ -29,3 +29,5 @@ Ctrl-C
# End of transcript or log.
"""]]
> [[done]]; see my comment --[[Joey]]