summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-22 11:54:50 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-22 11:54:50 -0400
commitf8ba6b3bb853f63421f4117abb3f8fe1b071c7ef (patch)
treecf437db8f33b3fe31269d73ae4e768dfe48061e6
parentaec14e8e2e1b69a8fc37f509b6d3a36b2cde1736 (diff)
uninit: Check and abort if there are symlinks to annexed content that are not checked into git.
-rw-r--r--Command/Uninit.hs23
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/uninit_loses_data_if_git-annex_add_didn__39__t_complete.mdwn1
3 files changed, 18 insertions, 8 deletions
diff --git a/Command/Uninit.hs b/Command/Uninit.hs
index 6ac3e1216..8b653da7d 100644
--- a/Command/Uninit.hs
+++ b/Command/Uninit.hs
@@ -36,7 +36,20 @@ check = do
[Params "rev-parse --abbrev-ref HEAD"]
seek :: [CommandSeek]
-seek = [withFilesInGit $ whenAnnexed startUnannex, withNothing start]
+seek = [
+ withFilesNotInGit $ whenAnnexed startCheckIncomplete,
+ withFilesInGit $ whenAnnexed startUnannex
+ , withNothing start
+ ]
+
+{- git annex symlinks that are not checked into git could be left by an
+ - interrupted add. -}
+startCheckIncomplete :: FilePath -> (Key, Backend) -> CommandStart
+startCheckIncomplete file _ = error $ unlines
+ [ file ++ " points to annexed content, but is not checked into git."
+ , "Perhaps this was left behind by an interrupted git annex add?"
+ , "Not continuing with uninit; either delete or git annex add the file and retry."
+ ]
startUnannex :: FilePath -> (Key, Backend) -> CommandStart
startUnannex file info = do
@@ -47,13 +60,7 @@ startUnannex file info = do
Command.Unannex.start file info
start :: CommandStart
-start = next perform
-
-perform :: CommandPerform
-perform = next cleanup
-
-cleanup :: CommandCleanup
-cleanup = do
+start = next $ next $ do
annexdir <- fromRepo gitAnnexDir
uninitialize
mapM_ removeAnnex =<< getKeysPresent
diff --git a/debian/changelog b/debian/changelog
index 4da5330bc..e55284c4c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ git-annex (3.20121018) UNRELEASED; urgency=low
* file:/// URLs can now be used with the web special remote.
* OSX: Stop installing non-self-contained webapp into Desktop directory.
* webapp: Allow dashes in ssh key comments when pairing.
+ * uninit: Check and abort if there are symlinks to annexed content that
+ are not checked into git.
-- Joey Hess <joeyh@debian.org> Wed, 17 Oct 2012 14:24:10 -0400
diff --git a/doc/bugs/uninit_loses_data_if_git-annex_add_didn__39__t_complete.mdwn b/doc/bugs/uninit_loses_data_if_git-annex_add_didn__39__t_complete.mdwn
index 6b5749eaf..61cfa89a5 100644
--- a/doc/bugs/uninit_loses_data_if_git-annex_add_didn__39__t_complete.mdwn
+++ b/doc/bugs/uninit_loses_data_if_git-annex_add_didn__39__t_complete.mdwn
@@ -12,3 +12,4 @@ I know there are two conflicting issues here:
Maybe uninit could check to see if all symlinks currently in the repo pointing to something under .git/annex/objects are committed. If not, commit them then uninit, or just de-annex them.
+> Added a check for this, [[done]] --[[Joey]]