aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-06-04 19:16:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-06-05 10:24:55 +0300
commitdfc89ec51c26d6226d767b79fe42e64af55e2b89 (patch)
tree3ef1357f10e33785289a1cee8b7eb92812af3841
parente3bbc554f4754df011bc50c969d23cb58a47ef51 (diff)
Fix crash in cmd_sync()
-rw-r--r--bdep/sync.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/bdep/sync.cxx b/bdep/sync.cxx
index 25ed63e..b7e71fb 100644
--- a/bdep/sync.cxx
+++ b/bdep/sync.cxx
@@ -1638,13 +1638,18 @@ namespace bdep
// Failed that it will be quite confusing since we may be re-fetching
// the same repositories over and over.
//
- if (cfgs.size () != 1 && *fetch)
+ // Note: counter-intuitively, we may end up here even if fetch is
+ // nullopt; see load_implicit() for details.
+ //
+ bool deep_fetch (fetch && *fetch);
+
+ if (cfgs.size () != 1 && deep_fetch)
text << "fetching in configuration " << p.representation ();
run_bpkg (bpkg_fetch_verb, co,
"fetch",
"-d", p,
- (*fetch ? nullptr : "--shallow"),
+ (deep_fetch ? nullptr : "--shallow"),
cfg.reps);
}