git branch -f master 1.0.1-1
popd
+mkdir packages.git
+pushd packages.git
+git init --bare
+(
+ echo 'commit refs/heads/prod'
+ echo 'mark :1'
+ echo 'committer Invirt Git Import <invirt@mit.edu> now'
+ echo 'data <<EOF'
+ echo 'Initial superrepo creation.'
+ echo 'EOF'
+ for r in $(ls ../packages); do
+ pushd "../packages/$r" &>/dev/null
+ commit="$(git rev-parse refs/heads/master)"
+ popd &>/dev/null
+
+ echo "M 160000 $commit ${r%.git}"
+ done
+
+ echo 'M 100644 inline .gitmodules'
+ echo 'data <<EOF'
+ for r in $(ls ../packages); do
+ r="${r%.git}"
+ printf '[submodule "%s"]\n' "$r"
+ printf '\tpath = %s\n' "$r"
+ printf '\turl = git://invirt.mit.edu/packages/%s.git\n' "$r"
+ done
+ echo 'EOF'
+
+ echo 'reset refs/heads/dev'
+ echo 'from :1'
+
+ echo 'reset HEAD'
+ echo 'from :1'
+) | git fast-import --date-format=now
+popd
+
echo
echo 'The Git migration was successful.'