aboutsummaryrefslogtreecommitdiff
path: root/Core.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-17 18:52:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-17 18:52:09 -0400
commit335c06171ac9a45a76b3b92d647615142bcc6ba0 (patch)
tree138cff5c4acafc75156f526d49b3cbdb52b7fdb7 /Core.hs
parentbb6707020d08f7509c21c1229088bb6017438caf (diff)
commit logs at end; faster
Diffstat (limited to 'Core.hs')
-rw-r--r--Core.hs20
1 files changed, 9 insertions, 11 deletions
diff --git a/Core.hs b/Core.hs
index 302e304e4..5f63002c1 100644
--- a/Core.hs
+++ b/Core.hs
@@ -34,8 +34,10 @@ shutdown = do
nocommit <- Annex.flagIsSet NoCommit
needcommit <- Annex.flagIsSet NeedCommit
if (needcommit && not nocommit)
- then liftIO $ Git.run g ["commit", "-q", "-m",
- "git-annex log update", gitStateDir g]
+ then do
+ liftIO $ Git.run g ["add", gitStateDir g]
+ liftIO $ Git.run g ["commit", "-q", "-m",
+ "git-annex log update", gitStateDir g]
else return ()
-- clean up any files left in the temp directory
@@ -75,14 +77,12 @@ inAnnex key = do
g <- Annex.gitRepo
liftIO $ doesFileExist $ annexLocation g key
-{- Adds, optionally also commits a file to git.
- -
- - All changes to the git repository should go through this function.
+{- Adds and commits a file to git.
-
- This is careful to not rely on the index. It may have staged changes,
- so only use operations that avoid committing such changes.
-}
-gitAdd :: FilePath -> Maybe String -> Annex ()
+gitAdd :: FilePath -> String -> Annex ()
gitAdd file commitmessage = do
nocommit <- Annex.flagIsSet NoCommit
if (nocommit)
@@ -90,10 +90,8 @@ gitAdd file commitmessage = do
else do
g <- Annex.gitRepo
liftIO $ Git.run g ["add", file]
- if (isJust commitmessage)
- then liftIO $ Git.run g ["commit", "--quiet",
- "-m", (fromJust commitmessage), file]
- else Annex.flagChange NeedCommit True
+ liftIO $ Git.run g ["commit", "--quiet",
+ "-m", commitmessage, file]
{- Calculates the relative path to use to link a file to a key. -}
calcGitLink :: FilePath -> Key -> Annex FilePath
@@ -112,7 +110,7 @@ logStatus key status = do
g <- Annex.gitRepo
u <- getUUID g
f <- liftIO $ logChange g key u status
- gitAdd f Nothing -- all logs are committed at end
+ Annex.flagChange NeedCommit True -- commit all logs at end
{- Output logging -}
showStart :: String -> String -> Annex ()