diff options
author | Joey Hess <joey@kitenet.net> | 2013-07-16 15:00:25 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-07-16 15:00:25 -0400 |
commit | ee55dd4a57a2bc7026ea56cd71a55ee73919a16f (patch) | |
tree | 3bb5138028d2d605f84267160ed80c8a3c890b20 /Command/Uninit.hs | |
parent | b16c208e0358c883470c88456c9fa527663c1d55 (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.
Diffstat (limited to 'Command/Uninit.hs')
-rw-r--r-- | Command/Uninit.hs | 23 |
1 files changed, 21 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 |