first_file_match() {
  OP="$1"
  shift
  while [ $# -gt 0 ]; do
    if [ "${OP}" = "$1" ]; then
      echo "$1"
      return 0
    fi
    shift
  done
  return 1
}

# GIT_BASE_DIR="$(dirname $(realpath "$(which git)") | sed -e 's#/bin##' -e 's#/libexec/git-core##')"
# GIT_COMPLETION_PATH=$(first_file_match -f \
#   "$GIT_BASE_DIR/etc/bash_completion.d/git-completion.bash" \
#   "$GIT_BASE_DIR/share/git/contrib/completion/git-completion.bash" \
#   "/usr/local/git/contrib/completion/git-completion.bash" \
#   "/opt/local/share/doc/git-core/contrib/completion/git-completion.bash" \
#   "/etc/bash_completion.d/git" \
#   "/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash" \
#   "/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash" \
# )
