#!/usr/bin/env pil
(de Mybench Prg
   (let U (usec)
      (prog1
         (run Prg 1)
         (out 2
            (prinl
               *Count
               " "
               (format (*/ (- (usec) U) 1000) 3) ) ) ) ) )
(de main ()
   (one *Count)
   (if
      (and
         (cd "/home/gitkernel")
         (call 'rm '-rf 'linux)
         (call 'git 'clone 'https://github.com/torvalds/linux)
         (cd "/home/gitkernel/linux")

         (call 'pijul 'init '.)
         (in '(bash -c "git log --pretty=format:\"%H:%s\"")
            (until (eof)
               (let L (line)
                  (setq Record
                     (pack
                        "pijul record -am. 1>/dev/null 2>&1"
                     )
                  )

                  # (println 'Record Record)
                  (call 'git 'checkout '-qf (pack (head 40 L)))
                  (call 'bash '-c "pijul add -r . 1>/dev/null 2>&1")
                  (Mybench (call 'bash '-c Record))

                  (inc '*Count)
               ) # let
            ) # until
         ) # in
      ) # and
           (msg "ok")
           (msg "fail")
        )


        (bye)
)