-
Notifications
You must be signed in to change notification settings - Fork 6
/
git-setup
executable file
·39 lines (34 loc) · 1.28 KB
/
git-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Basic setup for the puppet git repository
# Need this info
echo "Type your Labs console wiki username (ie: Test User):"
read name
echo "Type your shell username (ie: testuser):"
read username
echo "Type the e-mail address for this username:"
read email
# Global config
git config user.email "$email"
git config user.name "$name"
# Setup remotes/aliases
git remote add puppet ssh://[email protected]:29418/operations/puppet
git config alias.push-for-review-test "push puppet HEAD:refs/for/test"
git config alias.push-for-review-production "push puppet HEAD:refs/for/production"
TOPLEVEL=`git rev-parse --show-toplevel`
which curl
if [ "$?" == "0" ]
then
curl "https://gerrit.wikimedia.org/r/tools/hooks/commit-msg" > $TOPLEVEL/.git/hooks/commit-msg && chmod u+x $TOPLEVEL/.git/hooks/commit-msg
else
which wget
if [ "$?" == "0" ]
then
wget "https://gerrit.wikimedia.org/r/tools/hooks/commit-msg" -O $TOPLEVEL/.git/hooks/commit-msg && chmod u+x $TOPLEVEL/.git/hooks/commit-msg
else
scp -p 29418 gerrit.wikimedia.org:hooks/commit-msg $TOPLEVEL/.git/hooks/commit-msg
if [ "$?" != "0" ]
then
echo "Please download the commit message hook from https://gerrit.wikimedia.org/r/tools/hooks/commit-msg, place it in .git/hooks/commit-msg, and chmod u+x the file."
fi
fi
fi