feat(tools/tvlc): init project
tvlc is a tool for managing sparse git worktrees of the TVL depot. It is still in development; near-term tasks include a setup script, Nix dependency resolution, worktree removal, and the dispatch script. See cs.tvl.fyi/depot/docs/designs/SPARSE_CHECKOUTS.md for more info. Change-Id: Iad96656f0206178980fe7dcadd3dffe70d690f8f Reviewed-on: https://cl.tvl.fyi/c/depot/+/1760 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
d6f17f48de
commit
92d4554b62
5 changed files with 171 additions and 0 deletions
30
tools/tvlc/common.sh
Normal file
30
tools/tvlc/common.sh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
tvlc_root="$XDG_DATA_HOME/tvlc"
|
||||
|
||||
if [ -f "$tvlc_root"/nice_checkout_root ]; then
|
||||
nice_checkout_root="$(cat "$tvlc_root"/nice_checkout_root)"
|
||||
fi
|
||||
nice_checkout_root="${nice_checkout_root:-$HOME/tvlc}"
|
||||
|
||||
depot_root=
|
||||
if [ -f "$tvlc_root/depot_root" ]; then
|
||||
depot_root="$(cat "$tvlc_root/depot_root")"
|
||||
fi
|
||||
if [ -d /depot ]; then
|
||||
# don't require config on tvl nixos servers
|
||||
depot_root="${depot_root:-/depot}"
|
||||
fi
|
||||
if [ -n "$depot_root" ]; then
|
||||
export DEPOT_ROOT="$depot_root"
|
||||
fi
|
||||
|
||||
if [ ! -d "$tvlc_root" ]; then
|
||||
echo "tvlc: setup required"
|
||||
echo "please run 'tvlc setup' from the depot root"
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue