fix up commands that are trouble on bare repos
Most will just abort. init does a basic init and gives a command to run elsewhere to finish it.
This commit is contained in:
parent
b88637fff1
commit
b5b78f26ec
8 changed files with 31 additions and 23 deletions
|
@ -29,7 +29,7 @@ seek = [withStrings start]
|
|||
|
||||
{- Drops unused content by number. -}
|
||||
start :: CommandStartString
|
||||
start s = do
|
||||
start s = notBareRepo $ do
|
||||
m <- readUnusedLog
|
||||
case M.lookup s m of
|
||||
Nothing -> return Nothing
|
||||
|
|
|
@ -27,9 +27,8 @@ command = [Command "fromkey" paramPath seek
|
|||
seek :: [CommandSeek]
|
||||
seek = [withFilesMissing start]
|
||||
|
||||
{- Adds a file pointing at a manually-specified key -}
|
||||
start :: CommandStartString
|
||||
start file = do
|
||||
start file = notBareRepo $ do
|
||||
key <- cmdlineKey
|
||||
inbackend <- Backend.hasKey key
|
||||
unless inbackend $ error $
|
||||
|
|
|
@ -27,7 +27,7 @@ seek :: [CommandSeek]
|
|||
seek = [withAttrFilesInGit "annex.numcopies" start]
|
||||
|
||||
start :: CommandStartAttrFile
|
||||
start (file, attr) = isAnnexed file $ \(key, backend) -> do
|
||||
start (file, attr) = notBareRepo $ isAnnexed file $ \(key, backend) -> do
|
||||
showStart "fsck" file
|
||||
return $ Just $ perform key file backend numcopies
|
||||
where
|
||||
|
|
|
@ -41,11 +41,19 @@ perform :: String -> CommandPerform
|
|||
perform description = do
|
||||
g <- Annex.gitRepo
|
||||
u <- getUUID g
|
||||
describeUUID u description
|
||||
setVersion
|
||||
liftIO $ gitAttributesWrite g
|
||||
gitPreCommitHookWrite g
|
||||
return $ Just cleanup
|
||||
if Git.repoIsLocalBare g
|
||||
then do
|
||||
showLongNote $
|
||||
"This is a bare repository, so its description cannot be committed.\n" ++
|
||||
"To record the description, run this command in a clone of this repository:\n" ++
|
||||
" git annex describe " ++ (show u) ++ " '" ++ description ++ "'\n\n"
|
||||
return $ Just $ return True
|
||||
else do
|
||||
describeUUID u description
|
||||
liftIO $ gitAttributesWrite g
|
||||
gitPreCommitHookWrite g
|
||||
return $ Just cleanup
|
||||
|
||||
cleanup :: CommandCleanup
|
||||
cleanup = do
|
||||
|
|
|
@ -32,7 +32,7 @@ seek = [withNothing start]
|
|||
|
||||
{- Finds unused content in the annex. -}
|
||||
start :: CommandStartNothing
|
||||
start = do
|
||||
start = notBareRepo $ do
|
||||
showStart "unused" ""
|
||||
return $ Just perform
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue