uninit: Refuse to run in a subdirectory. Closes: #677076
This commit is contained in:
parent
28242b3bf8
commit
7f70767bfb
2 changed files with 8 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue