#!/bin/bash

usage() {
  echo "usage $0 <sha1> <sha2>:"
  echo "  Start a git bisect session between sha1 and sha2."
  echo "  This command will muck with your local git state. You can always use"
  echo "  \`git bisect reset\` to escape."
}

if [ -z "$1" ]; then
  echo
  echo "Missing the first sha to look up"
  echo
  usage
  exit 1
fi

if [ -z "$2" ]; then
  echo
  echo "Missing the second sha to look up"
  echo
  usage
  exit 1
fi


pushd $ZOOX_WORKSPACE_ROOT

git bisect start $2 $1

# use `brun //vehicle/planner/metrics:benchmark_timing` to evaluate each branch
# if you want to try this locally, use
#
# sudo cpufreq-set -r -g performance
# brun //vehicle/planner/metrics:py_planner_metrics_runner -- --apps run_time_test
#
# this only really works if the regressions are large enough
