avoid interleaving command stages with Concurrency 1

Before, -J1 was different than no -J: It makes concurrent-output be used
for display, and it actually can run concurrent jobs in some situations.
Eg, a perform stage and a cleanup stage can both run.

dupState is used in several places, and changes NonConcurrent to
Concurrent 1. My concern is that this might, in some case, enable
that concurrent behavior. And in particular, that it might get enabled in
--batch mode, when the user is not expecting concurrent output because
they did not pass -J.

While I don't have a test case where that happens and causes out of
order output, it looks like it could, and so prudent to make this change.
This commit is contained in:
Joey Hess 2020-09-16 12:10:45 -04:00
parent 877ef84a1b
commit b6642dde8a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -55,7 +55,9 @@ commandActions = mapM_ commandAction
commandAction :: CommandStart -> Annex ()
commandAction start = getConcurrency >>= \case
NonConcurrent -> runnonconcurrent
Concurrent _ -> runconcurrent
Concurrent n
| n > 1 -> runconcurrent
| otherwise -> runnonconcurrent
ConcurrentPerCpu -> runconcurrent
where
runnonconcurrent = void $ includeCommandAction start