Skip to content

Commit 5255244

Browse files
erinclemmermergify-bot
authored and
mergify-bot
committed
Ensure that --project-file flag overrides --ignore-project-flag
1 parent 70eebb1 commit 5255244

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cabal-install/src/Distribution/Client/ProjectFlags.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Distribution.ReadE (succeedReadE)
1414
import Distribution.Simple.Command
1515
( MkOptDescr, OptionField(optionName), ShowOrParseArgs (..), boolOpt', option
1616
, reqArg )
17-
import Distribution.Simple.Setup (Flag (..), flagToList, flagToMaybe, toFlag, trueArg)
17+
import Distribution.Simple.Setup (Flag (..), flagToList, flagToMaybe, toFlag, trueArg, fromFlagOrDefault)
1818

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

0 commit comments

Comments
 (0)