#!/usr/bin/env bash
set -euo pipefail

git_dir="$(git -C ZXDB rev-parse --git-dir)"
exclude_file="${git_dir}/info/exclude"

mkdir -p "$(dirname "${exclude_file}")"
touch "${exclude_file}"

add_exclude() {
  local pattern="$1"
  if ! grep -Fxq "${pattern}" "${exclude_file}"; then
    printf "%s\n" "${pattern}" >> "${exclude_file}"
  fi
}

add_exclude "ZXDB_mysql.sql"
add_exclude "ZXDB_mysql_STRUCTURE_ONLY.sql"
