~ecs/tm

ref: 0022137d89f12741ac3e6cf4173aa876cda5a726 tm/tm-init -rwxr-xr-x 459 bytes
0022137dEmber Sawady Fix shellcheck warnings 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh -eu

export TM_DIR="${TM_DIR:-$PWD/.tm}"
# shellcheck source=./lib.sh
. "$(dirname -- "$0")/lib.sh"
[ $# -ne 0 ] && abort "usage: tm init"
[ -z "${TM_AUTHOR:-}" ] && abort "error: TM_AUTHOR unset"
mkdir -p -- "$TM_DIR/objects" "$TM_DIR/refs"
[ -e "$TM_IGNORE" ] || cat <<EOF >"$TM_IGNORE"
\.tm(/.*)?$
\.git(/.*)?$
EOF
[ -e "$TM_DIR/refs/index" ] || echo "Initial commit" | tm commit
[ -e "$TM_DIR/refs/HEAD" ] || tm update-ref HEAD index >/dev/null