8 $dir="/tmp/ikiwiki-test-git.$$";
12 if (! -x $git || ! mkdir($dir) || ! mkdir($gitrepo)) {
14 use Test::More skip_all => "git not available or could not make test dirs"
18 use Test::More tests => 11;
20 BEGIN { use_ok("IkiWiki"); }
22 %config=IkiWiki::defaultconfig();
24 $config{srcdir} = "$dir/src";
25 IkiWiki::checkconfig();
27 system "cd $gitrepo && git init-db 2>/dev/null";
28 system "cd $gitrepo && echo dummy >dummy; git add . 2>/dev/null";
29 system "cd $gitrepo && git commit -m Initial 2>/dev/null";
30 system "git clone -l -s $gitrepo $config{srcdir} 2>/dev/null";
33 @changes = IkiWiki::rcs_recentchanges(3);
35 is($#changes, 0); # counts for dummy commit during repo creation
36 is($changes[0]{message}[0]{"line"}, "Initial");
37 is($changes[0]{pages}[0]{"page"}, "dummy");
40 my $test1 = readfile("t/test1.mdwn");
41 writefile('test1.mdwn', $config{srcdir}, $test1);
42 IkiWiki::rcs_add("test1.mdwn");
43 IkiWiki::rcs_commit("test1.mdwn", "Added the first page", "moo");
45 @changes = IkiWiki::rcs_recentchanges(3);
48 is($changes[0]{message}[0]{"line"}, "Added the first page");
49 is($changes[0]{pages}[0]{"page"}, "test1.mdwn");
52 my $message = "Added the second page";
54 my $test2 = readfile("t/test2.mdwn");
55 writefile('test2.mdwn', $config{srcdir}, $test2);
56 system "cd $config{srcdir}; git add test2.mdwn 2>/dev/null";
57 system "cd $config{srcdir}; git commit -m \"$message\" test2.mdwn 2>/dev/null";
58 system "cd $config{srcdir}; git push origin 2>/dev/null";
60 @changes = IkiWiki::rcs_recentchanges(3);
63 is($changes[0]{message}[0]{"line"}, $message);
64 is($changes[0]{pages}[0]{"page"}, "test2.mdwn");
66 is($changes[1]{pages}[0]{"page"}, "test1.mdwn");