netinstall: also fetch tags
[git/jnareb-git.git] / share / msysGit-netinstall / setup-msysgit.sh
blobd7acf835ca604bf3f48918ead73eaf683e2a946a
1 #!/bin/sh
3 # We're already in the install directory
4 INSTALL_PATH="$(pwd)"
5 export PATH="$INSTALL_PATH/installer-tmp/bin:$PATH"
7 error () {
8 echo "* error: $*"
9 echo INSTALLATION ABORTED
10 read -e IGNORED_INPUT
11 trap - exit
12 exit 1
15 echo -------------------------------------------------------
16 echo Checking environment
17 echo -------------------------------------------------------
18 type cygpath >/dev/null 2>/dev/null && {
19 echo "Cygwin seems to be in your system path. This was detected"
20 echo "by trying to run cygpath, which was found by this shell."
21 echo ""
22 echo "Cygwin may cause severe problems, like crashes, if used in"
23 echo "combination with msysgit. Please remove Cygwin from you system"
24 echo "PATH environment variable."
25 echo ""
26 echo "For assistance on how to control your environment variables"
27 echo "you should consult Microsoft's knowlege base:"
28 echo " Windows XP: http://support.microsoft.com/kb/310519"
29 echo " Windows NT: http://support.microsoft.com/kb/100843"
30 echo ""
31 error "Can not install msysgit when Cygwin is in PATH."
33 echo "Environment is clean. Can install msysgit."
35 echo
36 echo -------------------------------------------------------
37 echo Fetching the latest MSys environment
38 echo -------------------------------------------------------
39 MSYSGIT_REPO_GIT=git://repo.or.cz/msysgit.git
40 MSYSGIT_REPO_GIT_MOB=ssh://mob@repo.or.cz/srv/git/msysgit.git
41 MSYSGIT_REPO_HTTP=http://repo.or.cz/r/msysgit.git
43 # Multiply git.exe
45 for builtin in init unpack-objects update-ref fetch ls-remote clone checkout
47 ln "$INSTALL_PATH/installer-tmp/bin/git.exe" \
48 "$INSTALL_PATH/installer-tmp/bin/git-$builtin.exe"
49 done
51 git init &&
52 git config remote.origin.url $MSYSGIT_REPO_GIT &&
53 git config remote.origin.fetch \
54 +refs/heads/@@MSYSGITBRANCH@@:refs/remotes/origin/@@MSYSGITBRANCH@@ &&
55 git config branch.master.remote origin &&
56 git config branch.master.merge refs/heads/@@MSYSGITBRANCH@@ &&
57 git config remote.mob.url $MSYSGIT_REPO_GIT_MOB &&
58 git config remote.mob.fetch +refs/heads/mob:refs/remotes/origin/mob &&
59 git config remote.mob.push master:mob &&
61 USE_HTTP=
62 git fetch ||
63 USE_HTTP=t &&
64 git config remote.origin.url $MSYSGIT_REPO_HTTP &&
65 git fetch || {
66 echo -n "Please enter a HTTP proxy: " &&
67 read proxy &&
68 test ! -z "$proxy" &&
69 export http_proxy="$proxy" &&
70 git fetch
71 } ||
72 error "Could not get msysgit.git"
74 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
76 echo
77 echo -------------------------------------------------------
78 echo Checking out the master branch
79 echo -------------------------------------------------------
80 git-checkout -l -f -q -b master origin/@@MSYSGITBRANCH@@ ||
81 error Couldn\'t checkout the master branch!
84 # TEMP: Remove pre-existing git directory
85 rm -rf git
88 echo
89 echo -------------------------------------------------------
90 echo Fetching the latest MinGW Git sources
91 echo -------------------------------------------------------
93 case "$USE_HTTP" in
95 GIT_REPO_URL=http://repo.or.cz/r/git.git/
96 MINGW_REPO_URL=http://repo.or.cz/r/git/mingw.git/
97 MINGW4MSYSGIT_REPO_URL=http://repo.or.cz/r/git/mingw/4msysgit.git/
99 '')
100 GIT_REPO_URL=git://repo.or.cz/git.git
101 MINGW_REPO_URL=git://repo.or.cz/git/mingw.git
102 MINGW4MSYSGIT_REPO_URL=git://repo.or.cz/git/mingw/4msysgit.git
104 esac
106 git config submodule.git.url $MINGW4MSYSGIT_REPO_URL &&
107 mkdir git &&
108 cd git &&
109 git init &&
110 git config core.autocrlf input &&
111 git config remote.junio.url $GIT_REPO_URL &&
112 git config remote.junio.fetch '+refs/heads/*:refs/remotes/junio/*' &&
113 git fetch --tags junio &&
114 git config remote.mingw.url $MINGW_REPO_URL &&
115 git config remote.mingw.fetch '+refs/heads/*:refs/remotes/mingw/*' &&
116 git fetch --tags mingw &&
117 git config remote.origin.url $MINGW4MSYSGIT_REPO_URL &&
118 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' &&
119 git fetch --tags origin &&
120 if test -z "@@FOURMSYSGITBRANCH@@"
121 then
122 FOURMSYS=$(cd .. && git ls-tree HEAD git |
123 sed -n "s/^160000 commit \(.*\) git$/\1/p")
124 else
125 FOURMSYS=origin/@@FOURMSYSGITBRANCH@@
126 fi &&
127 git checkout -l -f -q $FOURMSYS ||
128 error Couldn\'t update submodule git!
130 echo
131 echo -------------------------------------------------------
132 echo Fetching HTML help pages
133 echo -------------------------------------------------------
135 cd .. &&
136 rm -rf /doc/git/html &&
137 git config submodule.html.url $GIT_REPO_URL &&
138 mkdir -p doc/git/html &&
139 cd doc/git/html &&
140 git init &&
141 git config remote.origin.url $GIT_REPO_URL &&
142 git config remote.origin.fetch '+refs/heads/html:refs/remotes/origin/html' &&
143 git fetch origin &&
144 git checkout -l -f -q $(cd ../../.. && git ls-tree HEAD doc/git/html |
145 sed -n "s/^160000 commit \(.*\).doc\/git\/html$/\1/p") ||
146 error "Couldn't update submodule doc/git/html (HTML help will not work)."