From e4c72d1a1e0dca1612ff1b24d5afd058d3adc9b6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 26 Mar 2015 14:02:35 -0400 Subject: assistant: Committing a whole lot of files at once could overflow command-line length limits and cause the commit to fail. This only happened when using the assistant in an indirect mode repository. --- Assistant/Threads/Committer.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Assistant') diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index 8fecc1c51..2951a8018 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -290,8 +290,12 @@ handleAdds havelsof delayadd cs = returnWhen (null incomplete) $ do -- files. The ls-files is run on a batch of files. findnew [] = return ([], noop) findnew pending@(exemplar:_) = do - (newfiles, cleanup) <- liftAnnex $ - inRepo (Git.LsFiles.notInRepo False $ map changeFile pending) + let segments = segmentXargs $ map changeFile pending + rs <- liftAnnex $ forM segments $ \fs -> + inRepo (Git.LsFiles.notInRepo False fs) + let (newfiles, cleanup) = foldl' + (\(l1, a1) (l2, a2) -> (l1 ++ l2, a1 >> a2)) + ([], return True) rs -- note: timestamp info is lost here let ts = changeTime exemplar return (map (PendingAddChange ts) newfiles, void $ liftIO cleanup) -- cgit v1.2.3