~ecs/tm

cbf50bae5667b64978b679f0af599b25d892e5ab — Ember Sawady 3 years ago 3528626
Fix some errors caught by shellcheck
3 files changed, 5 insertions(+), 7 deletions(-)

M tm-commit
M tm-commit-tree
M tm-insert
M tm-commit => tm-commit +1 -1
@@ 2,7 2,7 @@

. "$(dirname -- "$0")/lib.sh"
parents=
while getopts p: upt; do
while getopts p: opt; do
	case "$opt" in
	p)
		parents="$parents -p $OPTARG"

M tm-commit-tree => tm-commit-tree +2 -3
@@ 38,9 38,8 @@ printf "tree %s\n" "$ref" >>"$tmp"
for parent in $parents; do
	printf "parent %s\n" "$parent" >>"$tmp"
done
printf 'author %s\n' "$TM_AUTHOR" >>"$tmp"
printf 'committer %s\n' "$TM_COMMITTER" >>"$tmp"
printf 'date %s\n' "$TM_DATE" >>"$tmp"
printf 'author %s\ncomitter %s\ndate %s\n' "$TM_AUTHOR" \
	"$TM_COMMITTER" "$TM_DATE" >>"$tmp"
tty >/dev/null && printf 'Commit subject:\n' >&2
IFS= read -r "subject"
[ "$(printf "%s" "$subject" | wc -c)" -gt 72 ] \

M tm-insert => tm-insert +2 -3
@@ 31,7 31,7 @@ tmp="$TMPDIR/insert"
printf "%s\n" "$type" >"$tmp"
case "$type" in
blob)
	cat -- $@ >"$tmp"
	cat -- "$@" >"$tmp"
	;;
tree)
	[ $# -eq 1 ] && cd "$1"


@@ 54,8 54,7 @@ tree)
		[ "z$(ch 9 "$mode")" = "zw" ] && m="$((m + 2))"
		[ "z$(ch 10 "$mode")" = "zx" ] && m="$((m + 1))"
		set +e
		hash="$(tm insert -- "$file")"
		[ $? -eq 0 ] && printf "%s %s %s\n" "$m" "$hash" "$file" >>"$tmp"
		hash="$(tm insert -- "$file")" && printf "%s %s %s\n" "$m" "$hash" "$file" >>"$tmp"
		set -e
	done	
	;;