source: trunk/UTIL/git_init.sh @ 3428

Last change on this file since 3428 was 3414, checked in by afalco, 3 months ago

git init in UTIL/ dir + README. AF

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1# Script to initialize the git repository and link it to the svn.
2# The synchronization requires two pushes
3# (1st push=svn dcommit, 2nd push=git push)
4# WARNING: we assume the svn and the git are up-to-date
5SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6cd ${SCRIPT_DIR}/..
7
8echo "WARNING: this script will setup the git repo"
9echo "or download it in the git-trunk/ folder (and link with git-svn)."
10
11while true; do
12    read -p "Do you wish to continue? [y/n] " yn
13    case $yn in
14        [Yy]* ) break;;
15        [Nn]* ) exit;;
16        * ) echo "Please answer yes (y) or no (n).";;
17    esac
18done
19
20URL=git@gitlab.in2p3.fr:la-communaut-des-mod-les-atmosph-riques-plan-taires/git-trunk.git
21LOCAL_URL=`git remote get-url origin 2>/dev/null`
22if [ "${LOCAL_URL}" !=  "${URL}" ];then
23    git clone ${URL}
24    cd git-trunk
25fi
26
27# link svn to git as git-svn branch
28# (need git-svn to work)
29git svn init https://svn.lmd.jussieu.fr/Planeto/trunk
30
31git update-ref refs/remotes/git-svn refs/remotes/origin/master
32# git svn rebase # not used (we assume we're up-to-date)
33
34# install pre-push hook to ensure
35# users push only commits in sync with svn
36
37ln UTIL/pre-push .git/hooks
Note: See TracBrowser for help on using the repository browser.