bash: teach 'git checkout' options
[git/mingw.git] / contrib / fast-import / git-import.sh
blob0ca7718d0518db2e559ecd17eb6f7f57338b80fd
1 #!/bin/sh
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.
7 if [ -z "$1" -o -z "$2" ]; then
8 echo "Usage: git-import branch import-message"
9 exit 1
12 USERNAME="$(git config user.name)"
13 EMAIL="$(git config user.email)"
15 if [ -z "$USERNAME" -o -z "$EMAIL" ]; then
16 echo "You need to set user name and email"
17 exit 1
20 git init
23 cat <<EOF
24 commit refs/heads/$1
25 committer $USERNAME <$EMAIL> now
26 data <<MSGEOF
28 MSGEOF
30 EOF
31 find * -type f|while read i;do
32 echo "M 100644 inline $i"
33 echo data $(stat -c '%s' "$i")
34 cat "$i"
35 echo
36 done
37 echo
38 ) | git fast-import --date-format=now