about summary refs log tree commit diff
path: root/docs
diff options
context:
space:
mode:
authorKane York <kanepyork@gmail.com>2020-08-04T22·21-0700
committerkanepyork <rikingcoding@gmail.com>2020-08-08T10·11+0000
commitcc01059d405e982e3a7de78e318374c3dbace48b (patch)
treeac8f2951ed05460a9b8b64e80cab701fcf534850 /docs
parenta5dae62e85d9ff9db6c4088d64559d7bac713486 (diff)
docs(sparse): Add RFC design for depot worktree tool r/1614
This is meant to be a high-velocity alternative to writing an entire
FUSE filesystem to facilitate smaller checkouts of the depot.

The script mostly works today, except that remote dependency detection is not set up.

Change-Id: Idf9048df4f7ee39eaaedcdafcd9621f3d7479947
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1644
Tested-by: BuildkiteCI
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'docs')
-rw-r--r--docs/designs/SPARSE_CHECKOUTS.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/designs/SPARSE_CHECKOUTS.md b/docs/designs/SPARSE_CHECKOUTS.md
new file mode 100644
index 000000000000..fe3a4c0104e5
--- /dev/null
+++ b/docs/designs/SPARSE_CHECKOUTS.md
@@ -0,0 +1,37 @@
+Below is a prototype for a script to create Git sparse checkouts of the depot.
+The script below works today with relatively recent versions of git.
+
+Open items:
+
+ - Read-increment-write the checkout ID from a file in .git.
+ - `NICE_CHECKOUT_ROOT` should be a git configuration value.
+ - `tvl-get-depends` will be a script that contacts the build farm and asks for
+   the closure of a given source directory, using [depot-scan].
+
+```bash
+DEPOT_ROOT="${depot.depotPath}"
+XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
+CLIENT_ROOT="$XDG_DATA_HOME/tvlc/clients"
+NICE_CHECKOUT_ROOT="$HOME/tvlc"
+CHECKOUT_ID=1
+CHECKOUT_NAME=myclient # command line variables
+
+assertAbsolutePath "$CLIENT_ROOT"
+
+mkdir "$CLIENT_ROOT"/"$CHECKOUT_ID"
+ln -s "$CLIENT_ROOT"/"$CHECKOUT_ID" "$NICE_CHECKOUT_ROOT"/"$CHECKOUT_NAME"
+
+cd "$DEPOT_ROOT"
+git worktree add --no-checkout -b "tvlc-$CHECKOUT_ID" "$CLIENT_ROOT/$CHECKOUT_ID/" canon
+# BUG: git not creating the /info/ subdir
+mkdir "$DEPOT_ROOT"/.git/worktrees/"$CHECKOUT_ID"/info
+
+cd "$CLIENT_ROOT/$CHECKOUT_ID"
+git sparse-checkout init --cone
+git sparse-checkout set "$TARGET_DIR" nix/readTree overrides
+tvl-get-depends "$TARGET_DIR" | xargs git sparse-checkout add
+
+cd "$NICE_CHECKOUT_ROOT"/"$CHECKOUT_NAME"
+```
+
+[depot-scan]: ../users/edef/depot-scan.nix