Fix git test suite to use a bare repo.

This works around an enormous (and, in this context, enormously confusing)
message that git has begun to print when one attempts to push changes into
a non-bare repo.

As a bonus, it now tests whether ikiwiki-makerepo works.
master
Joey Hess 2009-04-04 14:58:34 -04:00
parent 90da6cc05c
commit 8a11983946
2 changed files with 11 additions and 13 deletions

5
debian/changelog vendored
View File

@ -1,4 +1,4 @@
ikiwiki (3.09) UNRELEASED; urgency=low ikiwiki (3.09) unstable; urgency=low
* inline: Add title_natural sort order, using Sort::Naturally * inline: Add title_natural sort order, using Sort::Naturally
(chrysn) (chrysn)
@ -13,8 +13,9 @@ ikiwiki (3.09) UNRELEASED; urgency=low
* Fix documentation of anonok_pagespec. Closes: #521793 * Fix documentation of anonok_pagespec. Closes: #521793
* Add missing suggests on libtext-textile-perl. Closes: #522039 * Add missing suggests on libtext-textile-perl. Closes: #522039
* recentchanges: change to using do=goto links for user links. * recentchanges: change to using do=goto links for user links.
* Fix git test suite to use a bare repo.
-- Joey Hess <joeyh@debian.org> Thu, 19 Mar 2009 15:32:49 -0400 -- Joey Hess <joeyh@debian.org> Sat, 04 Apr 2009 14:33:49 -0400
ikiwiki (3.08) unstable; urgency=low ikiwiki (3.08) unstable; urgency=low

19
t/git.t
View File

@ -3,19 +3,17 @@ use warnings;
use strict; use strict;
my $dir; my $dir;
my $gitrepo;
BEGIN { BEGIN {
$dir="/tmp/ikiwiki-test-git.$$"; $dir="/tmp/ikiwiki-test-git.$$";
$gitrepo="$dir/repo";
my $git=`which git`; my $git=`which git`;
chomp $git; chomp $git;
if (! -x $git || ! mkdir($dir) || ! mkdir($gitrepo)) { if (! -x $git || ! mkdir($dir)) {
eval q{ eval q{
use Test::More skip_all => "git not available or could not make test dirs" use Test::More skip_all => "git not available or could not make test dir"
} }
} }
} }
use Test::More tests => 16; use Test::More tests => 18;
BEGIN { use_ok("IkiWiki"); } BEGIN { use_ok("IkiWiki"); }
@ -25,17 +23,16 @@ $config{srcdir} = "$dir/src";
IkiWiki::loadplugins(); IkiWiki::loadplugins();
IkiWiki::checkconfig(); IkiWiki::checkconfig();
system "cd $gitrepo && git init >/dev/null 2>&1"; ok (mkdir($config{srcdir}));
system "cd $gitrepo && echo dummy > dummy; git add . >/dev/null 2>&1"; is (system("./ikiwiki-makerepo git $config{srcdir} $dir/repo"), 0);
system "cd $gitrepo && git commit -m Initial >/dev/null 2>&1";
system "git clone -l -s $gitrepo $config{srcdir} >/dev/null 2>&1";
my @changes; my @changes;
@changes = IkiWiki::rcs_recentchanges(3); @changes = IkiWiki::rcs_recentchanges(3);
is($#changes, 0); # counts for dummy commit during repo creation is($#changes, 0); # counts for dummy commit during repo creation
is($changes[0]{message}[0]{"line"}, "Initial"); # ikiwiki-makerepo's first commit is setting up the .gitignore
is($changes[0]{pages}[0]{"page"}, "dummy"); is($changes[0]{message}[0]{"line"}, "initial commit");
is($changes[0]{pages}[0]{"page"}, ".gitignore");
# Web commit # Web commit
my $test1 = readfile("t/test1.mdwn"); my $test1 = readfile("t/test1.mdwn");