Re: Google Summer of Code 2013 (GSoC13)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 18, 2013, 22:37 UTC
- Message-ID
- <7vehgd9rkg.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130218210709.GC27308@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> This is not related to GSoC anymore, but I think handling multiple > versions is already pretty easy. You can just install to > "$HOME/local/git/$TAGNAME" or similar, and then symlink the "bin/git" > binary from there into your PATH as git.$TAGNAME (e.g., git.v1.7.8). Git > already takes care of the messy bits, like making sure sub-programs are > invoked from the same git version. > > I already do this automagically with this script: > > https://github.com/peff/git/blob/meta/install/prefix > > I just set "prefix" in the Makefile based on the script, and when I > "make install" tags or topic branches, they go to the right place (and > the "links" script in the same directory maintains the symlinks for me). > > I never bothered to even submit those scripts to contrib, because I > figured they were so specific to my setup, and to keeping dozens of git > versions around (when debugging, it's nice to be able to check an old > version's behavior without even having to build it).
Yeah, I have been using the Make (in the todo branch, to be checked out in Meta/ subdirectory of the working tree) script for exactly this. After tagging a release, I'd do
git checkout -B snap v1.8.1.3
Meta/Make install install-docto install them in $inst_prefix/git-snap-v1.8.1.3. A "rungit" script can then be used like:
rungit v1.7.0 checkout blah
-- rungit script -- >8 -- rungit script -- #!/bin/sh # Run various vintage of git
variant="${0##*/}" &&
: ${RUNGIT_BASE=$HOME/g/$(getarch)} &&
case "$variant" in
rungit)
case $# in
0)
echo >&2 "which version?"
exit 1
;;
esac
variant=$1
shift
;;
esac &&
case "$variant" in
-l)
for d in "$RUNGIT_BASE/"git-*/bin/git
do
d=$(basename ${d%/bin/git})
d=${d#git-}
d=${d#snap-}
echo "$d"
done
exit
;;
git-*)
variant=${variant#git-} ;;
v[0-9]*)
variant=snap-$variant ;;
esac &&
d="$RUNGIT_BASE/git-$variant" &&
if test -f "$d/bin/git"
then
exec "$d/bin/git" "$@"
else
echo >&2 "$variant: No such variant for $a"
exit 1
fi