chiark / gitweb /
check wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 4 Nov 2016 13:46:39 +0000 (13:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 4 Nov 2016 13:46:39 +0000 (13:46 +0000)
check

diff --git a/check b/check
index 1524fde1287302f0aa4be275505196432f55f2ed..df4b83f411f64bbbfb296834fb86fda1deab805d 100755 (executable)
--- a/check
+++ b/check
@@ -1,12 +1,44 @@
 #!/bin/bash
 set -e
 set -o pipefail
+
 rm -rf stunt
 mkdir stunt
 cd stunt
+
+#exec 3<&0 </dev/null
+
 git init
 git commit --allow-empty -m 'Test object'
 head=`git rev-parse HEAD`
-perl -ne 'chomp; print "create refs/tags/$_ '$head'\n" or die $!' \
-| tee /dev/tty \
-| git update-ref --stdin
+
+#exec <&3 3<&-
+
+perl -we '
+    use strict;
+
+    our $file;
+    our $count;
+
+    sub complete_batch () {
+        if ($file) {
+            print STDERR "completing batch ($_)\n";
+            close $file or die $!;
+            system "git update-ref --stdin <batch"
+                and die "$? $!";
+        }
+       $file = undef;
+       $count = 0;
+    }
+
+    while (<>) {
+print STDERR ">$_<\n";
+        $file ||= new IO::File "batch", ">" or die $!;
+        chomp;
+       print $file "create refs/tags/$_ '$head'\n" or die $!;
+       $count++ < 1000 or complete_batch;
+    }
+print STDERR "FOO\n";
+    STDIN->error and die $!;
+    complete_batch();
+'