File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -299,10 +299,16 @@ impl<'gctx> Source for GitSource<'gctx> {
299
299
// If we're in offline mode, we're not locked, and we have a
300
300
// database, then try to resolve our reference with the preexisting
301
301
// repository.
302
- ( Revision :: Deferred ( git_ref) , Some ( db) ) if self . gctx . offline ( ) => {
302
+ ( Revision :: Deferred ( git_ref) , Some ( db) ) if !self . gctx . network_allowed ( ) => {
303
+ let offline_flag = self
304
+ . gctx
305
+ . offline_flag ( )
306
+ . expect ( "always present when `!network_allowed`" ) ;
303
307
let rev = db. resolve ( & git_ref) . with_context ( || {
304
- "failed to lookup reference in preexisting repository, and \
305
- can't check for updates in offline mode (--offline)"
308
+ format ! (
309
+ "failed to lookup reference in preexisting repository, and \
310
+ can't check for updates in offline mode ({offline_flag})"
311
+ )
306
312
} ) ?;
307
313
( db, rev)
308
314
}
@@ -312,9 +318,9 @@ impl<'gctx> Source for GitSource<'gctx> {
312
318
// situation that we have a locked revision but the database
313
319
// doesn't have it.
314
320
( locked_rev, db) => {
315
- if self . gctx . offline ( ) {
321
+ if let Some ( offline_flag ) = self . gctx . offline_flag ( ) {
316
322
anyhow:: bail!(
317
- "can't checkout from '{}': you are in the offline mode (--offline )" ,
323
+ "can't checkout from '{}': you are in the offline mode ({offline_flag} )" ,
318
324
self . remote. url( )
319
325
) ;
320
326
}
You can’t perform that action at this time.
0 commit comments