-open(MESSAGE, '<', $ARGV[0]) or die "$ARGV[0]: open: $!\n";
-my $message = join('', <MESSAGE>);
-close(MESSAGE);
+if (defined ($message_file)) {
+ open (MESSAGE, '<', $message_file)
+ or die "$0: failed to open \"$message_file\": $!\n";
+ $message .= join ('', <MESSAGE>);
+ close (MESSAGE);
+} elsif (!defined ($message)) {
+ $message = "Import of $tarball.\n";
+}
+
+if (! -e $tarball) {
+ die "$0: $tarball: not found\n";
+} elsif ($tarball =~ /gz$/) {
+ open (TARBALL, "-|", "zcat $tarball")
+ or die "$0: \"zcat $tarball\" failed to start: $!\n";
+} else {
+ open (TARBALL, '<', $tarball)
+ or die "$0: failed to open \"$tarball\": $!\n";
+}
+
+my $commit_user = `git config --get user.name`;
+chomp $commit_user;
+my $commit_email = `git config --get user.email`;
+chomp $commit_email;
+my $committer = "$commit_user <$commit_email>";
+
+open (GFI, "|-", "git fast-import --date-format=raw --quiet")
+ or die "$0: \"git fast-import\" failed to start: $!\n";