Skip to content

Commit dcfdc9c

Browse files
gbazKleidukos
authored andcommitted
cleanup and document a global repo flag
1 parent 47eb77b commit dcfdc9c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,12 @@ updateRepo verbosity _updateFlags repoCtxt (repo, indexState) = do
199199
-- NB: always update the timestamp, even if we didn't actually
200200
-- download anything
201201
writeIndexTimestamp index indexState
202-
ce <- if repoContextIgnoreExpiry repoCtxt
203-
then Just `fmap` getCurrentTime
204-
else return Nothing
205-
updated <- Sec.uncheckClientErrors $ Sec.checkForUpdates repoSecure ce
202+
-- typically we get the current time to check expiry against
203+
-- but if the flag is set, we don't.
204+
now <- case repoContextIgnoreExpiry repoCtxt of
205+
False -> Just <$> getCurrentTime
206+
True -> pure Nothing
207+
updated <- Sec.uncheckClientErrors $ Sec.checkForUpdates repoSecure now
206208
-- this resolves indexState (which could be HEAD) into a timestamp
207209
new_ts <- currentIndexTimestamp (lessVerbose verbosity) repoCtxt repo
208210
let rname = remoteRepoName (repoRemote repo)

0 commit comments

Comments
 (0)