1 ! Copyright (C) 2015 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: fry git io io.directories io.encodings.utf8 io.files.temp
4 io.files.unique io.launcher kernel sequences tools.test ;
7 : run-process-stdout ( process -- string )
8 >process utf8 [ contents ] with-process-reader ;
10 : with-empty-test-git-repo ( quot -- )
13 { "git" "init" } run-process drop
15 ] cleanup-unique-directory
16 ] with-temp-directory ; inline
18 : with-zero-byte-file-repo ( quot -- )
20 "empty-file" touch-file
21 { "git" "add" "empty-file" } run-process drop
22 { "git" "commit" "-m" "initial commit of empty file" } run-process drop
24 ] with-empty-test-git-repo ; inline
26 { "refs/heads/master" } [
27 [ git-head-ref ] with-empty-test-git-repo
33 ! "." t recursive-directory-files
34 git-log [ commit. ] each
35 ] with-zero-byte-file-repo
40 { "git" "log" } run-process-stdout print
41 ] with-zero-byte-file-repo