~ecs/tm

ref: 95cb618f450695312ff6849e7c6e86709e985ae9 tm/tm-commit -rwxr-xr-x 577 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
14
15
16
17
18
19
20
21
22
#!/bin/sh

. "$(dirname -- "$0")/lib.sh"
while getopts p: opt; do
	case "$opt" in
	p)
		parents="${parents:-} -p $OPTARG"
		;;
	?)
		abort "usage: tm commit [-p <parent>]... [<file>|<directory>]"
		;;
	esac
done

shift "$((OPTIND - 1))"

tm resolve-ref HEAD >/dev/null 2>/dev/null && : "${parents=-p HEAD}"

[ $# -gt 1 ] && abort "usage: tm commit [-p <parent>]... [<file>|<directory>]"
tree="$(tm insert "${1:-.}")" || abort "failed to insert ${1:-.}"
commit="$(tm commit-tree $parents "$tree")" || abort "failed to commit $tree"
exec tm update-ref index "$commit" >/dev/null