Files
odoo_source/checkout.sh
T
xmo-odoo 59354d5bf3 [IMP] remove setting of color.ui
After further considering PR #21's arguments, the setup script should
not go around setting `color.ui`:

* it shouldn't be needed for recent gits with default compile
  settings[0]
* it may override advanced users's own colour configuration/
  customisations (or disabling)
* it forces default colours on users for which it may be useless
  (colour- blind) or even detrimental (other vision impairments)
* some linux distributions apparently default to idiotic pagers which
  can't handle ANSI colour codes by default and spew garbage to the
  terminal

[0] https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.4.txt#L178-L180
2014-05-17 11:44:09 +02:00

96 lines
2.0 KiB
Bash
Executable File

#/bin/sh
set -e
ODOO=https://github.com/odoo/odoo.git
DEV=https://github.com/odoo-dev/odoo.git
usage () {
cat <<EOF
Usage: $0 [-m] [COPYNAME]
Checks out and sets up the Odoo git repository for "internal" development.
* Checks out the "production" repository (production branches) as the "odoo"
remote
* Checks out the "development" repository (for employee development branches)
as the "dev" repository
By default, the working copy is "odoo"
Options:
-h displays this help text
-m includes github's merge refs. These are the pull requests to "odoo"
which merge cleanly into the main repository, after having applied
them to said repository
EOF
}
while getopts :hm opt
do
case $opt in
h)
usage
exit 0
;;
m)
include_merge=yes
;;
*)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
copyname=${1:-"odoo"}
# Collect basic configuration data, ensures correct configuration of that repo
printf "Enter your full name: "
read name
printf "Enter your (work) email: "
read email
# create & set up repo
git init $copyname
cd $copyname
git config user.name "$name"
git config user.email "$email"
# pre-push script preventing push to odoo repo by default. Git just execs
# them, so they need a correct shebang and exec bit
# if things get more extensive, should probably use git init templates
cat <<EOF > .git/hooks/pre-push
#!/bin/sh
remote="\$1"
url="\$2"
if [ "\$url" != "$ODOO" ]
then
exit 0
fi
echo "Pushing to the odoo remote ($ODOO) is forbidden, push to the dev remote"
echo
echo "See git help push if you really want to push to odoo"
exit 1
EOF
chmod +x .git/hooks/pre-push
# add basic repos as remotes
git remote add odoo $ODOO
git remote add dev $DEV
if [ $include_merge ]
then
git remote add merge $ODOO
git config remote.merge.fetch '+refs/pull/*/merge:refs/remotes/merge/*'
fi
echo
git remote update
exit 0