Skip to content

Commit

Permalink
Ensure that --project-file flag overrides --ignore-project-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
cbclemmer authored and mergify-bot committed Apr 25, 2022
1 parent 70eebb1 commit 5255244
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cabal-install/src/Distribution/Client/ProjectFlags.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Distribution.ReadE (succeedReadE)
import Distribution.Simple.Command
( MkOptDescr, OptionField(optionName), ShowOrParseArgs (..), boolOpt', option
, reqArg )
import Distribution.Simple.Setup (Flag (..), flagToList, flagToMaybe, toFlag, trueArg)
import Distribution.Simple.Setup (Flag (..), flagToList, flagToMaybe, toFlag, trueArg, fromFlagOrDefault)

data ProjectFlags = ProjectFlags
{ flagProjectFileName :: Flag FilePath
Expand Down Expand Up @@ -47,7 +47,8 @@ projectFlagsOptions showOrParseArgs =
(reqArg "FILE" (succeedReadE Flag) flagToList)
, option ['z'] ["ignore-project"]
"Ignore local project configuration"
flagIgnoreProject (\v flags -> flags { flagIgnoreProject = v })
-- If the "--project-file" flag is set, then this will always be false
flagIgnoreProject (\v flags -> flags { flagIgnoreProject = toFlag (not ((not (fromFlagOrDefault False v)) || (NoFlag /= (flagProjectFileName flags)))) })
(yesNoOpt showOrParseArgs)
]

Expand Down

0 comments on commit 5255244

Please sign in to comment.