1#!/bin/sh 2# 3# Performs an initial import of a directory. This is the equivalent 4# of doing 'git init; git add .; git commit'. It's a lot slower, 5# but is meant to be a simple fast-import example. 6 7if[-z"$1"-o -z"$2"];then 8echo"usage: git-import branch import-message" 9exit1 10fi 11 12USERNAME="$(git config user.name)" 13EMAIL="$(git config user.email)" 14 15if[-z"$USERNAME"-o -z"$EMAIL"];then 16echo"You need to set user name and email" 17exit1 18fi 19 20git init 21 22( 23cat<<EOF 24commit refs/heads/$1 25committer$USERNAME<$EMAIL> now 26data <<MSGEOF 27$2 28MSGEOF 29 30EOF 31find*-type f|whileread i;do 32echo"M 100644 inline$i" 33echo data $(stat -c '%s' "$i") 34cat"$i" 35echo 36done 37echo 38) | git fast-import --date-format=now