~ecs/tm

ref: 95cb618f450695312ff6849e7c6e86709e985ae9 tm/tm-next -rwxr-xr-x 432 bytes
95cb618fEmber Sawady init: use commit instead of commit-tree 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

. "$(dirname -- "$0")/lib.sh"
[ $# -gt 1 ] && abort "usage: tm next [<ref>]"
new="$(tm resolve-ref "${1:-index}")" || exit 1
for ref in $(ls "$TM_DIR/refs/"); do
	[ "z$ref" = "zHEAD" ] && continue
	# XXX: is this the right thing to do?
	[ "z$ref" = "zindex" ] && continue
	resolved="$(tm resolve-ref "$ref")" || exit 1
	[ "z$new" = "z$resolved" ] && tm update-ref "$ref" "${1:-index}"
done
exec tm update-ref HEAD "$new"