From: "Shawn O. Pearce" <spearce@spearce.org>
To: git@vger.kernel.org
Subject: Upgrade to 1.5.0 utility
Date: Wed, 14 Mar 2007 02:16:12 -0400 [thread overview]
Message-ID: <20070314061611.GD20978@spearce.org> (raw)
Yesterday on #git DrNick wanted a script to update a pre-1.5.0
Git repository to be like a 1.5.0 (and later) style repository.
This basically means rewriting the remotes into .git/config, setting
up wildcard tracking branches under refs/remotes and deleting the
old tracking branches from the refs/heads namespace.
Much earlier I had cobbled together a short shell script that does
this for a *working directory repository*. Please don't use it on
a bare repository, at least not without editing, as it is hardcoding
the config options. ;-)
Here it is:
cat <<END_OF_SCRIPT >upgrade.sh
#!/bin/sh
##
## Upgrades a pre-1.5.0 repository to a 1.5.0-style layout.
## Use at your own risk. I've used it to upgrade many of
## my own repositories, but I also know what I'm doing. ;-)
##
sh remotes2config.sh; # from git.git/contrib
git config core.bare false
git config core.logallrefupdates true
for r in $(git remote)
do
old="`git config --get-all remote.$r.fetch | sed s,^.*:refs/heads/,,`"
if [ -z "$old" ]
then
echo "No fetch lines for $r."
continue
fi
echo "Converting $r..."
git config --replace-all remote.$r.fetch +refs/heads/*:refs/remotes/$r/*
git fetch $r
for r in $old
do
case "$r" in
*:*) echo "Not deleting $r" ;;
*) git branch -D $r ;;
esac
done
done
END_OF_SCRIPT
--
Shawn.
reply other threads:[~2007-03-14 6:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070314061611.GD20978@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.