Some versions of "which" output something on stdout even in the error case. Better do:

```
if ! which repo >/dev/null 2>&1; then
  # repo not found
fi
if ! which git >/dev/null 2>&1; then
  # git not found
fi
```

Also, possibly check if REPO and/or GIT have already been set to allow overriding, e.g.:

```
if [ -z $REPO ]; then
  # determine REPO via which
else
  # check if [ -x $REPO ] ...
fi
```

(this would allow things like `GIT=../some/local/git/install/bin/git extract-headers ...`)