~ecs/tm

ref: 0022137d89f12741ac3e6cf4173aa876cda5a726 tm/tm-update-ref -rwxr-xr-x 297 bytes
0022137dEmber Sawady Fix shellcheck warnings 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
#!/bin/sh -eu

# shellcheck source=./lib.sh
. "$(dirname -- "$0")/lib.sh"
[ $# -ne 2 ] && abort "usage: tm update-ref <refname> <ref>"
[ -f "$TM_DIR/refs/$1" ] || printf "creating ref %s\n" "$1"
ref="$(tm resolve-ref "$2")" || abort "error: invalid ref $2"
printf "%s\n" "$ref" >"$TM_DIR/refs/$1"