Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/contrib/fast-import/git-import.perl # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / contrib / fast-import / git-import.perl` 64 lines ยท 1451 bytes Raw Blame History 1 #!/usr/bin/perl 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 little slower, 5 # but is meant to be a simple fast-import example. 6 7 use strict; 8 use File::Find; 9 10 my $USAGE = 'usage: git-import branch import-message'; 11 my $branch = shift or die "$USAGE\n"; 12 my $message = shift or die "$USAGE\n"; 13 14 chomp(my $username = `git config user.name`); 15 chomp(my $email = `git config user.email`); 16 die 'You need to set user name and email' 17 unless $username && $email; 18 19 system('git init'); 20 open(my $fi, '|-', qw(git fast-import --date-format=now)) 21 or die "unable to spawn fast-import: $!"; 22 23 print $fi < now 26 data < 0) { 52 my $r = read($in, my $buf, $len < 4096 ? $len : 4096); 53 defined($r) or die "read error from $fn: $!"; 54 $r > 0 or die "premature EOF from $fn: $!"; 55 print $fi $buf; 56 $len -= $r; 57 } 58 print $fi "\n"; 59 60 }, '.' 61 ); 62 63 close($fi); 64 exit $?;