-find . -name .git -prune -o -type f -printf '%T@ %P\n' | sort -n | tail -1 | while read ts fn; do
- git commit --date="$ts" --author="$AUTHOR" -m 'auto commit for import'
-done
+foreach ($files->()) {
+ next if m|^\.git/|;
+ next if m|^git-slurp$|;
+ my $ts = gmstamp((stat $_)[9]);
+ push @{$ts{$ts}}, $_;
+}
+
+my $git = Git::Repository->new({
+ env => {
+ GIT_AUTHOR_EMAIL => $email,
+ GIT_AUTHOR_NAME => $author,
+ },
+ }
+);
+
+print $git->work_tree, "\n";
+foreach my $ts (sort { $a cmp $b } keys %ts) {
+ print "$ts @{$ts{$ts}}\n";
+ foreach my $file (@{$ts{$ts}}) {
+ $git->run('add', $file);
+ }
+ $git->run('commit', '--date', $ts, '-m', "add files for $ts");
+}