refactor
This commit is contained in:
parent
63a292324d
commit
64bc4e4751
2 changed files with 6 additions and 9 deletions
|
@ -9,8 +9,6 @@ module Command.Init where
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import Command
|
import Command
|
||||||
import Annex.UUID
|
|
||||||
import Logs.UUID
|
|
||||||
import Init
|
import Init
|
||||||
|
|
||||||
def :: [Command]
|
def :: [Command]
|
||||||
|
@ -29,7 +27,5 @@ start ws = do
|
||||||
|
|
||||||
perform :: String -> CommandPerform
|
perform :: String -> CommandPerform
|
||||||
perform description = do
|
perform description = do
|
||||||
initialize
|
initialize (Just description)
|
||||||
u <- getUUID
|
|
||||||
describeUUID u description
|
|
||||||
next $ return True
|
next $ return True
|
||||||
|
|
9
Init.hs
9
Init.hs
|
@ -19,13 +19,14 @@ import Logs.UUID
|
||||||
import Annex.Version
|
import Annex.Version
|
||||||
import Annex.UUID
|
import Annex.UUID
|
||||||
|
|
||||||
initialize :: Annex ()
|
initialize :: Maybe String -> Annex ()
|
||||||
initialize = do
|
initialize mdescription = do
|
||||||
prepUUID
|
prepUUID
|
||||||
Annex.Branch.create
|
Annex.Branch.create
|
||||||
setVersion
|
setVersion
|
||||||
gitPreCommitHookWrite
|
gitPreCommitHookWrite
|
||||||
getUUID >>= recordUUID
|
u <- getUUID
|
||||||
|
maybe (recordUUID u) (describeUUID u) mdescription
|
||||||
|
|
||||||
uninitialize :: Annex ()
|
uninitialize :: Annex ()
|
||||||
uninitialize = gitPreCommitHookUnWrite
|
uninitialize = gitPreCommitHookUnWrite
|
||||||
|
@ -40,7 +41,7 @@ ensureInitialized = getVersion >>= maybe needsinit checkVersion
|
||||||
needsinit = do
|
needsinit = do
|
||||||
annexed <- Annex.Branch.hasSomeBranch
|
annexed <- Annex.Branch.hasSomeBranch
|
||||||
if annexed
|
if annexed
|
||||||
then initialize
|
then initialize Nothing
|
||||||
else error "First run: git-annex init"
|
else error "First run: git-annex init"
|
||||||
|
|
||||||
{- set up a git pre-commit hook, if one is not already present -}
|
{- set up a git pre-commit hook, if one is not already present -}
|
||||||
|
|
Loading…
Reference in a new issue