Debian Codegraph @

docs/casts/seamless_nested_repos.sh

raw
1 say "DataLad makes a tree of nested Git repositories feel like a big monorepo..."
2
3 say "Let's create a root dataset"
4 run "datalad create demo"
5 run "cd demo"
6 say "Any DataLad dataset is just a Git repo with some initial configuration"
7 run "git log --oneline"
8
9 say "We can nest datasets, by telling DataLad to register a new dataset in a parent dataset"
10 run "datalad create -d . sub1"
11 say "A subdataset is a regular Git submodule"
12 run "git submodule"
13
14 say "Datasets can be nested arbitrarily deep"
15 run "datalad create -d . sub1/justadir/sub2"
16
17 say "Unlike Git, DataLad automatically takes care of committing all changes associated with the added subdataset up to the given parent dataset"
18 run "datalad status"
19
20 say "Let's create some content in the deepest subdataset"
21 run "mkdir sub1/justadir/sub2/anotherdir"
22 run "touch sub1/justadir/sub2/anotherdir/afile"
23
24 say "Git only reports changes within a repository, in the case the whole subdataset"
25 run "git status"
26
27 say "DataLad considers the entire tree"
28 run "datalad status -r"
29
30 say "Like Git, it can report individual untracked files, but also across repository boundaries"
31 run "datalad status -r --untracked all"
32
33 say "Adding this new content with Git or git-annex would be an exercise"
34 run_expfail "git add sub1/justadir/sub2/anotherdir/afile"
35
36 say "Again, DataLad does not require users to determine the correct repository"
37 run "datalad save -d . sub1/justadir/sub2/anotherdir/afile"
38
39 say "All associated changes in the entire dataset tree were committed"
40 run "datalad status"
41
42 say "DataLad's 'diff' is able to report the changes from these related commits throughout the repository tree"
43 run "datalad diff -r -f @~1"