summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-18 01:52:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-18 01:52:06 -0400
commit4b1086cc7d1dd9cb4eba78210976a731a683948d (patch)
tree52bad795d9cd83ff69d4d0304d9571a2d75b673a
parent939a6f860e1a2eea58e46a05861076e1b174cbd2 (diff)
experimentally, removing all actual git committing
Idea is the user will commit when ready, just stage everything.
-rw-r--r--BackendTypes.hs3
-rw-r--r--Commands.hs14
-rw-r--r--Core.hs29
-rw-r--r--LocationLog.hs6
4 files changed, 9 insertions, 43 deletions
diff --git a/BackendTypes.hs b/BackendTypes.hs
index e372099b2..548ef17a2 100644
--- a/BackendTypes.hs
+++ b/BackendTypes.hs
@@ -11,8 +11,7 @@ import Data.String.Utils
import qualified GitRepo as Git
-- command-line flags
-data Flag = Force | NoCommit | NeedCommit
- deriving (Eq, Read, Show)
+data Flag = Force deriving (Eq, Read, Show)
-- git-annex's runtime state type doesn't really belong here,
-- but it uses Backend, so has to be here to avoid a depends loop.
diff --git a/Commands.hs b/Commands.hs
index de3089a56..718e991c9 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -49,7 +49,6 @@ cmds = [
options = [
Option ['f'] ["force"] (NoArg Force) "allow actions that may loose annexed data"
- , Option ['N'] ["no-commit"] (NoArg NoCommit) "do not stage or commit changes"
]
header = "Usage: git-annex [" ++ (join "|" $ map cmdname cmds) ++ "] ..."
@@ -123,7 +122,7 @@ addCmd file = inBackend file $ do
liftIO $ renameFile file dest
link <- calcGitLink file key
liftIO $ createSymbolicLink link file
- gitAdd file $ "git-annex annexed " ++ file
+ liftIO $ Git.run g ["add", file]
showEndOk
{- Undo addCmd. -}
@@ -138,14 +137,8 @@ unannexCmd file = notinBackend file $ \(key, backend) -> do
moveout g src
where
moveout g src = do
- nocommit <- Annex.flagIsSet NoCommit
liftIO $ removeFile file
liftIO $ Git.run g ["rm", "--quiet", file]
- if (not nocommit)
- then liftIO $ Git.run g ["commit", "--quiet",
- "-m", ("git-annex unannexed " ++ file),
- file]
- else return ()
-- git rm deletes empty directories;
-- put them back
liftIO $ createDirectoryIfMissing True (parentDir file)
@@ -212,7 +205,8 @@ fixCmd file = notinBackend file $ \(key, backend) -> do
liftIO $ createDirectoryIfMissing True (parentDir file)
liftIO $ removeFile file
liftIO $ createSymbolicLink link file
- gitAdd file $ "git-annex fix " ++ file
+ g <- Annex.gitRepo
+ liftIO $ Git.run g ["add", file]
showEndOk
{- Stores description for the repository. -}
@@ -227,7 +221,7 @@ initCmd description = do
u <- getUUID g
describeUUID u description
log <- uuidLog
- gitAdd log $ "description for UUID " ++ (show u)
+ liftIO $ Git.run g ["add", log]
liftIO $ putStrLn "description set"
-- helpers
diff --git a/Core.hs b/Core.hs
index 5f63002c1..0af22ee73 100644
--- a/Core.hs
+++ b/Core.hs
@@ -30,15 +30,7 @@ shutdown :: Annex ()
shutdown = do
g <- Annex.gitRepo
- -- handle pending commits
- nocommit <- Annex.flagIsSet NoCommit
- needcommit <- Annex.flagIsSet NeedCommit
- if (needcommit && not nocommit)
- then do
- liftIO $ Git.run g ["add", gitStateDir g]
- liftIO $ Git.run g ["commit", "-q", "-m",
- "git-annex log update", gitStateDir g]
- else return ()
+ liftIO $ Git.run g ["add", gitStateDir g]
-- clean up any files left in the temp directory
let tmp = annexTmpLocation g
@@ -77,22 +69,6 @@ inAnnex key = do
g <- Annex.gitRepo
liftIO $ doesFileExist $ annexLocation g key
-{- 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 -> String -> Annex ()
-gitAdd file commitmessage = do
- nocommit <- Annex.flagIsSet NoCommit
- if (nocommit)
- then return ()
- else do
- g <- Annex.gitRepo
- liftIO $ Git.run g ["add", file]
- 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
calcGitLink file key = do
@@ -109,8 +85,7 @@ logStatus :: Key -> LogStatus -> Annex ()
logStatus key status = do
g <- Annex.gitRepo
u <- getUUID g
- f <- liftIO $ logChange g key u status
- Annex.flagChange NeedCommit True -- commit all logs at end
+ liftIO $ logChange g key u status
{- Output logging -}
showStart :: String -> String -> Annex ()
diff --git a/LocationLog.hs b/LocationLog.hs
index 4a5fe449c..785b3330d 100644
--- a/LocationLog.hs
+++ b/LocationLog.hs
@@ -80,14 +80,12 @@ instance Read LogLine where
undefined = ret $ LogLine (0) Undefined ""
ret v = [(v, "")]
-{- Log a change in the presence of a key's value in a repository,
- - and return the log filename. -}
-logChange :: Git.Repo -> Key -> UUID -> LogStatus -> IO FilePath
+{- Log a change in the presence of a key's value in a repository. -}
+logChange :: Git.Repo -> Key -> UUID -> LogStatus -> IO ()
logChange repo key uuid status = do
log <- logNow status uuid
ls <- readLog logfile
writeLog logfile (compactLog $ log:ls)
- return logfile
where
logfile = logFile repo key