uninit: Check and abort if there are symlinks to annexed content that are not checked into git.

This commit is contained in:
Joey Hess 2012-10-22 11:54:50 -04:00
parent 12efabf070
commit b05981d973
3 changed files with 18 additions and 8 deletions

View file

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

2
debian/changelog vendored
View file

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

View file

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