~ecs/tm

9b9f65e1ab0ba4dfd0b08a8882d094ee508a499c — Ember Sawady 3 years ago 86baa2c
commit-tree: add type to commit
2 files changed, 3 insertions(+), 3 deletions(-)

M tm-commit-tree
M tm-read-commit
M tm-commit-tree => tm-commit-tree +2 -2
@@ 32,9 32,9 @@ TM_COMMITTER="${TM_COMMITTER:-$TM_AUTHOR}"
# TODO: %s isn't POSIX
TM_DATE="${TM_DATE:-$(date -u +'%s')}"
tmp="$TMPDIR/commit-tree"

printf 'commit\n' >>"$tmp"
ref="$(tm resolve-ref "$1")" || abort "error: invalid ref $1"
printf "tree %s\n" "$ref" >"$tmp"
printf "tree %s\n" "$ref" >>"$tmp"
for parent in $parents; do
	printf "parent %s\n" "$parent" >>"$tmp"
done

M tm-read-commit => tm-read-commit +1 -1
@@ 18,7 18,7 @@ shift "$((OPTIND - 1))"
[ $# -eq 1 ] || abort "usage: tm read-commit [-t|-p|-a|-c|-d|-s|-b] <ref>"
script=
case "$mode" in
t) script='{ sub(/^tree /, ""); if (NR == 1) print }';;
t) script='/^tree / { sub(/^tree /, ""); print }';;
p) script='/^parent / { sub(/^parent /, ""); print } /^date/ { exit }';;
a) script='/^author / { sub(/^author /, ""); print; exit }';;
c) script='/^committer / { sub(/^committer /, ""); print; exit }';;