uninit: Refuse to run in a subdirectory. Closes: #677076

This commit is contained in:
Joey Hess 2012-06-11 10:33:58 -04:00
parent 28242b3bf8
commit 7f70767bfb
2 changed files with 8 additions and 3 deletions

View file

@ -23,9 +23,13 @@ def = [addCheck check $ command "uninit" paramPaths seek
check :: Annex ()
check = do
b <- current_branch
b <- current_branch
when (b == Annex.Branch.name) $ error $
"cannot uninit when the " ++ show b ++ " branch is checked out"
top <- fromRepo Git.repoPath
cwd <- liftIO getCurrentDirectory
whenM ((/=) <$> liftIO (absPath top) <*> liftIO (absPath cwd)) $ error $
"can only run uninit from the top of the git repository"
where
current_branch = Git.Ref . Prelude.head . lines <$> revhead
revhead = inRepo $ Git.Command.pipeRead

5
debian/changelog vendored
View file

@ -1,10 +1,11 @@
git-annex (3.20120606) UNRELEASED; urgency=low
git-annex (3.20120611) unstable; urgency=medium
* add: Prevent (most) modifications from being made to a file while it
is being added to the annex.
* initremote: Automatically describe a remote when creating it.
* uninit: Refuse to run in a subdirectory. Closes: #677076
-- Joey Hess <joeyh@debian.org> Tue, 05 Jun 2012 20:25:51 -0400
-- Joey Hess <joeyh@debian.org> Mon, 11 Jun 2012 10:32:01 -0400
git-annex (3.20120605) unstable; urgency=low