Skip to content
Snippets Groups Projects
update_mirror.sh 711 B
Newer Older
Sam Gleske's avatar
Sam Gleske committed
#!/bin/bash
Sam Gleske's avatar
Sam Gleske committed
#Created by Sam Gleske
#MIT License
#Created Tue Sep 10 23:01:08 EDT 2013
Sam Gleske's avatar
Sam Gleske committed
#USAGE
#  ./update_mirror.sh project_name

Sam Gleske's avatar
Sam Gleske committed
#bash option stop on first error
set -e
Sam Gleske's avatar
Sam Gleske committed
#Include all user options and dependencies
git_mirrors_dir="$(dirname "${0}")"
cd "${git_mirrors_dir}"
. "config.sh"
. "lib/VERSION"
. "lib/functions.sh"

PROGNAME="${0##*/}"
PROGVERSION="${VERSION}"

#Default script options
project_name=""
Sam Gleske's avatar
Sam Gleske committed

if [ -z "$1" ];then
  echo "Must specify a project_name!" 1>&2
  exit 1
elif [ ! -d "${repo_dir}/${gitlab_namespace}/$1" ];then
  echo "No git repository for $1!  Perhaps run add_mirror.sh?" 1>&2
  exit 1
fi

cd "${repo_dir}/${gitlab_namespace}/$1"
git fetch
git remote prune origin
git push gitlab