From 5c933bd4cf768701b8c68779657ece1a648b3f17 Mon Sep 17 00:00:00 2001 From: hallgren Date: Fri, 2 Oct 2015 11:46:29 +0000 Subject: [PATCH] Setup.hs: fix off-by-one error the change count in the version info The difference between "One change" and "No changes" is very noticeable. --- Setup.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Setup.hs b/Setup.hs index 71bf797e2..fea8a6938 100644 --- a/Setup.hs +++ b/Setup.hs @@ -392,18 +392,18 @@ extractDarcsVersion distFlag = versionModulePath = autogenPath"DarcsVersion_gf.hs" modname = "DarcsVersion_gf" - askDarcs = - do flip unless (fail "no _darcs") =<< doesDirectoryExist "_darcs" - tags <- lines `fmap` readProcess "darcs" ["show","tags"] "" - let from = case tags of - [] -> [] - tag:_ -> ["--from-tag="++tag] - dates <- patches `fmap` readProcess "darcs" ("changes":from) "" --- let dates = init' (filter ((`notElem` [""," "]).take 1) changes) - whatsnew <- tryIOE $ lines `fmap` readProcess "darcs" ["whatsnew","-s"] "" - return (listToMaybe tags,listToMaybe dates, - length dates,either (const 0) length whatsnew) - +askDarcs = + do flip unless (fail "no _darcs") =<< doesDirectoryExist "_darcs" + tags <- lines `fmap` readProcess "darcs" ["show","tags"] "" + let from = case tags of + [] -> [] + tag:_ -> ["--from-tag="++tag] + dates <- (init' . patches) `fmap` readProcess "darcs" ("changes":from) "" +-- let dates = init' (filter ((`notElem` [""," "]).take 1) changes) + whatsnew <- tryIOE $ lines `fmap` readProcess "darcs" ["whatsnew","-s"] "" + return (listToMaybe tags,listToMaybe dates, + length dates,either (const 0) length whatsnew) + where init' [] = [] init' xs = init xs