#!/usr/bin/env bash

command:upgrade() {
  local path="$0"
  local branch="$(git rev-parse --abbrev-ref HEAD)"
  if [ "$branch" != master ]; then
    error "git-hub repo is not on the 'master' branch"
  fi
  if [[ "$path" =~ ^/ ]] && [[ "$path" =~ ^(.*/git-hub)/lib/git-hub$ ]]; then
    (
      set -x
      cd "${BASH_REMATCH[1]}"
      git pull --rebase
    )
  else
    die "\

Sorry. Your installation can't use the 'git hub upgrade' command. The command
only works if you installed git hub by adding '/path/to/git-hub' to your PATH.

If you used 'make install' to install git-hub, then just do this:

    cd /path/to/git-hub
    git pull
    make install

"
  fi
}
