diff --git a/scripts/setup-git.sh b/scripts/setup-git.sh new file mode 100755 index 0000000000..9781417f98 --- /dev/null +++ b/scripts/setup-git.sh @@ -0,0 +1,76 @@ +#!/bin/bash +##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- +##### setup git properly for FreeSWITCH + +if [ ! -d .git ]; then + echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 + exit 1; +fi + +err () { + echo "error: $1" 1>&2 + exit 1 +} + +if ! git config user.name >/dev/null 2>&1; then + name=$(git config user.name) + [ -z "$name" ] \ + && [ -n "$NAME" ] && name="$NAME" || name="" + echo -n "What is your name? [$name]: " + read name_ + [ -n "$name_" ] && name="$name_" + [ -z "$name" ] && err "Your name is required." + git config --global user.name "$name" +fi + +if ! git config user.email >/dev/null 2>&1; then + email=$(git config user.email) + [ -z "$email" ] \ + && [ -n "$EMAIL" ] && email="$EMAIL" || email="" + echo -n "What is your email? [$email]: " + read email_ + [ -n "$email_" ] && email="$email_" + [ -z "$email" ] && err "Your email is required." + git config --global user.email "$email" +fi + +git config branch.master.rebase true + +cat 1>&2 <&2 <&2 <&2 <