-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 $committer_ident = `git var GIT_COMMITTER_IDENT`;
+chomp $committer_ident;
+
+open (GFI, "|-", "git fast-import --date-format=raw --quiet")
+ or die "$0: \"git fast-import\" failed to start: $!\n";