diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-16 19:57:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-16 19:57:56 -0400 |
commit | c69e747d383d308d0cf65d88dc1c3be139d056a9 (patch) | |
tree | f035189a3438fcc7e8826cab31f0c4c48aa205a5 /Commands.hs | |
parent | be5b1defeb2f3b5499fd3c002fcdba5b5e9d15f5 (diff) |
refactor
Diffstat (limited to 'Commands.hs')
-rw-r--r-- | Commands.hs | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/Commands.hs b/Commands.hs index 63ca6b5e4..f33be5393 100644 --- a/Commands.hs +++ b/Commands.hs @@ -114,13 +114,7 @@ addCmd file = inBackend file err $ do liftIO $ createDirectoryIfMissing True (parentDir dest) liftIO $ renameFile file dest liftIO $ createSymbolicLink (link ++ reldest) file - nocommit <- Annex.flagIsSet NoCommit - if (not nocommit) - then do - liftIO $ Git.run g ["add", file] - liftIO $ Git.run g ["commit", "-m", - ("git-annex annexed " ++ file), file] - else return () + gitAdd file $ Just $ "git-annex annexed " ++ file {- Inverse of addCmd. -} unannexCmd :: FilePath -> Annex () @@ -201,11 +195,7 @@ describeCmd description = do u <- getUUID g describeUUID u description log <- uuidLog - nocommit <- Annex.flagIsSet NoCommit - if (not nocommit) - then liftIO $ Git.run g ["add", log] - else return () - Annex.flagChange NeedCommit True + gitAdd log Nothing -- all logs are committed at end liftIO $ putStrLn "description set" {- Updates the LocationLog when a key's presence changes. -} @@ -214,11 +204,7 @@ logStatus key status = do g <- Annex.gitRepo u <- getUUID g f <- liftIO $ logChange g key u status - nocommit <- Annex.flagIsSet NoCommit - if (not nocommit) - then liftIO $ Git.run g ["add", f] - else return () - Annex.flagChange NeedCommit True + gitAdd f Nothing -- all logs are committed at end inBackend file yes no = do r <- liftIO $ Backend.lookupFile file |