+tools_dir=$(dirname "$0")
+# shellcheck source=/dev/null
+. "$tools_dir/common.sh" ''
+
+if [ "$1" = '-n' ]; then
+ shift
+ last=$(tail -n1 "$SHA1_FILE" | cut -f1 -d$'\t')
+ start_from=$(awk -F '\t' '/^[^#]/ && $3 == "'"$last"'" {
+ do
+ getline;
+ while (/^#/ || $2 == "branch");
+ print $3;
+ exit 0;
+ }' "$CTRL_FILE")
+fi
+
+if [ "$1" = '-s' ]; then
+ shift
+ start_from="$1"
+ if [ -z "$start_from" ]; then
+ printf '-s requires a start tree\n' 1>&2
+ exit 1
+ fi
+ shift
+fi