aboutsummaryrefslogtreecommitdiff
path: root/Utility/Path.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-02 01:23:43 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-02 01:24:37 -0400
commit8b17e33b84b0f60da422e2c32a5fa6f53c10df6d (patch)
treef9f2414ba9a705556de0bc76971353cbec3019d8 /Utility/Path.hs
parent69b92b22d9a80055c94d687b7f0810f82776624a (diff)
Revert "Significantly sped up processing of large numbers of directories passed to a single git-annex command."
This reverts commit 5492d8f4ddbd398e0188da9daed840908d1198c0. Whoops, git ls-files does not always output in the input ordering. That's why all this work is needed. Urk.
Diffstat (limited to 'Utility/Path.hs')
-rw-r--r--Utility/Path.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs
index ceecf3829..755436448 100644
--- a/Utility/Path.hs
+++ b/Utility/Path.hs
@@ -170,19 +170,17 @@ prop_relPathDirToFile_regressionTest = same_dir_shortcurcuits_at_difference
== joinPath ["..", "..", "..", "..", ".git", "annex", "objects", "18", "gk", "SHA256-foo", "SHA256-foo"]
{- Given an original list of paths, and an expanded list derived from it,
- - partitions the expanded list, so that sublist corresponds to one of the
+ - generates a list of lists, where each sublist corresponds to one of the
- original paths. When the original path is a directory, any items
- in the expanded list that are contained in that directory will appear in
- its segment.
- -
- - The expanded list must have the same ordering as the original list.
-}
segmentPaths :: [FilePath] -> [FilePath] -> [[FilePath]]
segmentPaths [] new = [new]
segmentPaths [_] new = [new] -- optimisation
segmentPaths (l:ls) new = found : segmentPaths ls rest
where
- (found, rest) = break (\p -> not (l `dirContains` p)) new
+ (found, rest)=partition (l `dirContains`) new
{- This assumes that it's cheaper to call segmentPaths on the result,
- than it would be to run the action separately with each path. In