summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-05 13:26:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-05 13:26:59 -0400
commit44e973dd0948afb25c47f176db83c34f90f49932 (patch)
tree91fab9d391dc946879a3026a127a0522a7b7f8d2
parentbddbb66ea4caf22e799e1bd8261e01a789697cc1 (diff)
fork a process to feed git hash-object
This is another workaround for bug #624389. I hope it will fix http://git-annex.branchable.com/bugs/problem_with_upgrade_v2_-__62___v3/
-rw-r--r--Branch.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/Branch.hs b/Branch.hs
index c0c96611b..d091b6eda 100644
--- a/Branch.hs
+++ b/Branch.hs
@@ -27,6 +27,8 @@ import Data.Maybe
import Data.List
import System.IO
import System.IO.Binary
+import System.Posix.Process
+import System.Exit
import qualified Data.ByteString.Char8 as B
import Types.BranchState
@@ -329,12 +331,19 @@ stageJournalFiles = do
let paths = map (dir </>) fs
-- inject all the journal files directly into git
-- in one quick command
- (h, s) <- Git.pipeWriteRead g [Param "hash-object",
- Param "-w", Param "--stdin-paths"] $ unlines paths
+ (pid, fromh, toh) <- hPipeBoth "git" $ toCommand $
+ Git.gitCommandLine g [Param "hash-object", Param "-w", Param "--stdin-paths"]
+ _ <- forkProcess $ do
+ hPutStr toh $ unlines paths
+ hClose toh
+ exitSuccess
+ hClose toh
+ s <- hGetContents fromh
-- update the index, also in just one command
Git.UnionMerge.update_index g $
index_lines (lines s) $ map fileJournal fs
- forceSuccess h
+ hClose fromh
+ forceSuccess pid
mapM_ removeFile paths
index_lines shas fs = map genline $ zip shas fs
genline (sha, file) = Git.UnionMerge.update_index_line sha file