summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-04-04 14:58:34 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-04-04 14:58:34 -0400
commit8a119839464fbfdf6fc3e8c302fa3d9cac7eab6b (patch)
tree84ce3d1425d5127e81475badc370ebdd43bc8749 /t
parent90da6cc05ca92ab856b21eff1a35cfb7d84db5f6 (diff)
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.
Diffstat (limited to 't')
-rwxr-xr-xt/git.t19
1 files changed, 8 insertions, 11 deletions
diff --git a/t/git.t b/t/git.t
index b3aa6a80b..f1c24b359 100755
--- a/t/git.t
+++ b/t/git.t
@@ -3,19 +3,17 @@ use warnings;
use strict;
my $dir;
-my $gitrepo;
BEGIN {
$dir="/tmp/ikiwiki-test-git.$$";
- $gitrepo="$dir/repo";
my $git=`which git`;
chomp $git;
- if (! -x $git || ! mkdir($dir) || ! mkdir($gitrepo)) {
+ if (! -x $git || ! mkdir($dir)) {
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"); }
@@ -25,17 +23,16 @@ $config{srcdir} = "$dir/src";
IkiWiki::loadplugins();
IkiWiki::checkconfig();
-system "cd $gitrepo && git init >/dev/null 2>&1";
-system "cd $gitrepo && echo dummy > dummy; git add . >/dev/null 2>&1";
-system "cd $gitrepo && git commit -m Initial >/dev/null 2>&1";
-system "git clone -l -s $gitrepo $config{srcdir} >/dev/null 2>&1";
+ok (mkdir($config{srcdir}));
+is (system("./ikiwiki-makerepo git $config{srcdir} $dir/repo"), 0);
my @changes;
@changes = IkiWiki::rcs_recentchanges(3);
is($#changes, 0); # counts for dummy commit during repo creation
-is($changes[0]{message}[0]{"line"}, "Initial");
-is($changes[0]{pages}[0]{"page"}, "dummy");
+# ikiwiki-makerepo's first commit is setting up the .gitignore
+is($changes[0]{message}[0]{"line"}, "initial commit");
+is($changes[0]{pages}[0]{"page"}, ".gitignore");
# Web commit
my $test1 = readfile("t/test1.mdwn");