Former-commit-id:b9fb1c89d4
[formerly8309193ce9
] [formerly31ae7ea218
] [formerly79ce6cfd97
[formerly31ae7ea218
[formerly 6601ddb09c2928754c2c3859dac284998d73ff81]]] Former-commit-id:79ce6cfd97
Former-commit-id: b452006db8c662d7b75e89f5dcc158103aa65a9b [formerly0c5d9e2416
] Former-commit-id:aed7a644df
58 lines
1.1 KiB
Bash
58 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
#
|
|
# where am I?
|
|
#
|
|
PWD=`pwd`
|
|
|
|
#
|
|
# where is this script?
|
|
#
|
|
MY_PATH=`dirname $0`
|
|
|
|
#
|
|
# Figure out repository path
|
|
#
|
|
if [ $MY_PATH == "." ]; then
|
|
GIT_REPO_DIR=`dirname $PWD`
|
|
GIT_REPO_DIR=`dirname $GIT_REPO_DIR`
|
|
elif [ $MY_PATH == "tools/scripts" ]; then
|
|
GIT_REPO_DIR=$PWD
|
|
else
|
|
cd $MY_PATH
|
|
cd ../../
|
|
GIT_REPO_DIR=`pwd`
|
|
fi
|
|
|
|
#
|
|
# Is this a Gerrit clone?
|
|
#
|
|
grep "lightning.omaha.us.ray.com:29418" ${GIT_REPO_DIR}/.git/config >/dev/null 2>&1
|
|
if [ "$?" == "0" ]; then
|
|
GERRIT_CLONE=1
|
|
else
|
|
GERRIT_CLONE=0
|
|
fi
|
|
|
|
#
|
|
# Disclaimer / preface / continue prompt
|
|
#
|
|
echo " "
|
|
echo "This script will:"
|
|
if [ "$GERRIT_CLONE" == "1" ]; then
|
|
echo " Copy the Gerrit commit-msg (for inserting the change-id) hook to your repository hooks directory "
|
|
else
|
|
echo " Do nothing since this repository is not a Gerrit clone"
|
|
fi
|
|
echo " "
|
|
read -p "Press [Enter] key to continue (ctrl-c to quit).."
|
|
|
|
|
|
|
|
if [ "$GERRIT_CLONE" == "1" ]; then
|
|
# cp change id hook
|
|
echo "Copying Gerrit commit-msg hook to ${GIT_REPO_DIR}/.git/hooks .."
|
|
cp ${GIT_REPO_DIR}/tools/scripts/commit-msg ${GIT_REPO_DIR}/.git/hooks
|
|
else
|
|
echo "Doing nothing .."
|
|
fi
|