1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use Path;
use Result;
use craterun_in;
use crateui;
/// Every scaffolded project should be a git repo - required outright for
/// the git-submodule package workflow, and just generally part of a
/// professional setup regardless of which package workflow is in use.
/// Fetches the contents of every submodule the project declares.
///
/// A plain `git clone` records each submodule's commit and leaves its
/// directory empty. `modules/submodules/default.project.json` maps
/// straight into those directories, and rojo refuses to build a sourcemap
/// for a `$path` it can't turn into an instance - so `rproj watch` on a
/// fresh clone of a submodule project printed "Watching for changes" and
/// then died on `File $path: ./charm/packages/charm/src`, having watched
/// nothing. Reproduced by cloning a scaffolded project without
/// `--recurse-submodules`, which is what `git clone <url>` does by default.
///
/// This is the submodule half of what `wally::sync` does for Wally
/// projects, whose `Packages/` is absent from a fresh clone for the same
/// reason (gitignored). Wally projects recovered on their own; submodule
/// ones did not, and the asymmetry was invisible on any machine where the
/// project had been scaffolded rather than cloned.
///
/// `add_submodule` can't stand in for this: its "already present" check is
/// a directory-exists check, and after a clone the directory exists and is
/// empty.
/// Adds `repo_url` as a submodule under `modules/submodules/<dir>` -
/// nested under an extra `submodules/` level rather than directly under
/// `modules/`, matching the structure used by littensy/fishing-minigame (a
/// real project consuming several of this catalog's packages this same
/// way). Multiple wally-catalog packages can share the same underlying repo
/// (monorepos like littensy/charm), so callers should dedupe by `dir`
/// before calling this - each repo only needs to be cloned once.