summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2012-04-28 12:03:32 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2012-04-28 22:58:09 +0530
commit48ed4deb8fa87f5aec22f7f9d9fc7df950d9c325 (patch)
tree9304dda992838897a9568e951c789dc56d2c5617
parentsolaris doesn't like 'hostname -s'... (diff)
downloadgitolite-gentoo-48ed4deb8fa87f5aec22f7f9d9fc7df950d9c325.tar.gz
gitolite-gentoo-48ed4deb8fa87f5aec22f7f9d9fc7df950d9c325.tar.bz2
gitolite-gentoo-48ed4deb8fa87f5aec22f7f9d9fc7df950d9c325.zip
BSD compat changes
thanks to milki for all the efforts! Details: - partial-copy fell afoul of BSD not having $RANDOM - test suite: fix bad GNU sort with good perl sort - test suite: fix md5sum dependency (which BSD doesn't have or can't easily have or requires extra options or whatever...), by doing it in perl. (Requires Digest::MD5, which is probably available anyway, but since this is only for the test suite, meh!)
-rw-r--r--doc/non-core.mkd3
-rwxr-xr-xsrc/VREF/partial-copy6
-rw-r--r--src/lib/Gitolite/Test.pm12
-rw-r--r--src/lib/Gitolite/Test/Tsh.pm4
-rwxr-xr-xt/0-me-first.t2
-rwxr-xr-xt/fork.t9
-rwxr-xr-xt/git-config.t56
-rwxr-xr-xt/partial-copy.t6
8 files changed, 58 insertions, 40 deletions
diff --git a/doc/non-core.mkd b/doc/non-core.mkd
index e6f9eab..b893e0a 100644
--- a/doc/non-core.mkd
+++ b/doc/non-core.mkd
@@ -121,6 +121,9 @@ Here's how:
- VREF/partial-copy = @all
config gitolite.partialCopyOf = foo
+ **IMPORTANT**: if you're using other VREFs, please make sure this one is
+ placed at the end, after all the others.
+
And that should be it. **Please test it and let me know if it doesn't work!**
WARNINGS:
diff --git a/src/VREF/partial-copy b/src/VREF/partial-copy
index efb73bf..19111de 100755
--- a/src/VREF/partial-copy
+++ b/src/VREF/partial-copy
@@ -20,13 +20,13 @@ exec >&2
main=`git config --file $GL_REPO_BASE/$repo.git/config --get gitolite.partialCopyOf`;
[ -z "$main" ] && exit 0
-rand=$RANDOM
+rand=$$
export GL_BYPASS_ACCESS_CHECKS=1
-git push -f $GL_REPO_BASE/$main.git $new:refs/heads/br-$rand || die "FATAL: failed to send $new"
+git push -f $GL_REPO_BASE/$main.git $new:refs/partial/br-$rand || die "FATAL: failed to send $new"
cd $GL_REPO_BASE/$main.git
-git update-ref -d refs/heads/br-$rand
+git update-ref -d refs/partial/br-$rand
git update-ref $ref $new $old || die "FATAL: update-ref for $ref failed"
exit 0
diff --git a/src/lib/Gitolite/Test.pm b/src/lib/Gitolite/Test.pm
index 07838f0..48a2330 100644
--- a/src/lib/Gitolite/Test.pm
+++ b/src/lib/Gitolite/Test.pm
@@ -8,15 +8,18 @@ package Gitolite::Test;
try
put
text
+ lines
dump
confreset
confadd
cmp
+ md5sum
);
#>>>
use Exporter 'import';
use File::Path qw(mkpath);
use Carp qw(carp cluck croak confess);
+use Digest::MD5 qw(md5_hex);
use Gitolite::Common;
@@ -25,6 +28,7 @@ BEGIN {
*{'try'} = \&Tsh::try;
*{'put'} = \&Tsh::put;
*{'text'} = \&Tsh::text;
+ *{'lines'} = \&Tsh::lines;
*{'cmp'} = \&Tsh::cmp;
}
@@ -100,4 +104,12 @@ sub confadd {
put "|cat >> conf/$file", $string;
}
+sub md5sum {
+ my $out = '';
+ for my $file (@_) {
+ $out .= md5_hex(slurp($file)) . " $file\n";
+ }
+ return $out;
+}
+
1;
diff --git a/src/lib/Gitolite/Test/Tsh.pm b/src/lib/Gitolite/Test/Tsh.pm
index 2097acd..2b7dcee 100644
--- a/src/lib/Gitolite/Test/Tsh.pm
+++ b/src/lib/Gitolite/Test/Tsh.pm
@@ -473,9 +473,9 @@ sub fail {
}
sub cmp {
- # compare input string with text()
- my $text = text();
+ # compare input string with second input string or text()
my $in = shift;
+ my $text = ( @_ ? +shift : text() );
if ( $text eq $in ) {
ok();
diff --git a/t/0-me-first.t b/t/0-me-first.t
index a11dfd0..dc8916b 100755
--- a/t/0-me-first.t
+++ b/t/0-me-first.t
@@ -32,7 +32,7 @@ try "
glt clone u1 file://aa u1aa; ok; /Cloning into 'u1aa'.../
/warning: You appear to have cloned an empty repository/
ls -ald --time-style=long-iso u1aa;
- ok; /drwxr-xr-x 3 $ENV{USER} $ENV{USER} 4096 201.-..-.. ..:.. u1aa/
+ ok; /drwxr-xr-x 3 $ENV{USER} $ENV{USER} \\d+ 201.-..-.. ..:.. u1aa/
# basic clone deny
glt clone u4 file://aa u4aa; !ok; /R any aa u4 DENIED by fallthru/
diff --git a/t/fork.t b/t/fork.t
index afa88ef..38cb200 100755
--- a/t/fork.t
+++ b/t/fork.t
@@ -59,13 +59,14 @@ try "
# now check the various files that should have been produced
-try "cd $rb; find . -name gl-perms | sort | xargs md5sum"; cmp
+my $t;
+try "cd $rb; find . -name gl-perms"; $t = md5sum(sort (lines())); cmp $t,
'59b3a74b4d33c7631f08e75e7b60c7ce ./foo/u1/u1a2.git/gl-perms
59b3a74b4d33c7631f08e75e7b60c7ce ./foo/u1/u1e.git/gl-perms
';
-try "cd $rb; find . -name gl-creator | sort | xargs md5sum"; cmp
-'346955ff2eadbf76e19373f07dd370a9 ./foo/u1/u1a2.git/gl-creator
-e4774cdda0793f86414e8b9140bb6db4 ./foo/u1/u1a.git/gl-creator
+try "cd $rb; find . -name gl-creator"; $t = md5sum(sort (lines())); cmp $t,
+'e4774cdda0793f86414e8b9140bb6db4 ./foo/u1/u1a.git/gl-creator
+346955ff2eadbf76e19373f07dd370a9 ./foo/u1/u1a2.git/gl-creator
346955ff2eadbf76e19373f07dd370a9 ./foo/u1/u1e.git/gl-creator
';
diff --git a/t/git-config.t b/t/git-config.t
index 437e1cc..18f2e78 100755
--- a/t/git-config.t
+++ b/t/git-config.t
@@ -15,6 +15,8 @@ try "pwd";
my $od = text();
chomp($od);
+my $t; # temp
+
# try an invalid config key
confreset;confadd '
@@ -62,13 +64,15 @@ try "ADMIN_PUSH set1; !/FATAL/" or die text();
my $rb = `gitolite query-rc -n GL_REPO_BASE`;
try "
cd $rb; ok
- egrep foo\\|bar *.git/config | sort
+ egrep foo\\|bar *.git/config
";
-cmp 'bar.git/config: bare = true
-bar.git/config: bar = one
+$t = join("\n", sort (lines()));
+
+cmp $t, 'bar.git/config: bar = one
+bar.git/config: bare = true
bar.git/config:[foo]
-foo.git/config: bare = true
foo.git/config: bar = f1
+foo.git/config: bare = true
foo.git/config:[foo]
frob.git/config: bar = dft
frob.git/config: bare = true
@@ -76,8 +80,7 @@ frob.git/config:[foo]
gitolite-admin.git/config: bare = true
testing.git/config: bar = dft
testing.git/config: bare = true
-testing.git/config:[foo]
-';
+testing.git/config:[foo]';
try "cd $od; ok";
@@ -97,23 +100,23 @@ try "ADMIN_PUSH set1; !/FATAL/" or die text();
try "
cd $rb; ok
- egrep foo\\|bar *.git/config | sort
+ egrep foo\\|bar *.git/config
";
+$t = join("\n", sort (lines()));
-cmp 'bar.git/config: bare = true
-bar.git/config: bar = one
+cmp $t, 'bar.git/config: bar = one
+bar.git/config: bare = true
bar.git/config:[foo]
-foo.git/config: bare = true
foo.git/config: bar = f1
+foo.git/config: bare = true
foo.git/config:[foo]
-frob.git/config: bare = true
frob.git/config: bar = none
+frob.git/config: bare = true
frob.git/config:[foo]
gitolite-admin.git/config: bare = true
testing.git/config: bar = dft
testing.git/config: bare = true
-testing.git/config:[foo]
-';
+testing.git/config:[foo]';
try "cd $od; ok";
@@ -129,22 +132,22 @@ try "ADMIN_PUSH set1; !/FATAL/" or die text();
try "
cd $rb; ok
- egrep foo\\|bar *.git/config | sort
+ egrep foo\\|bar *.git/config
";
+$t = join("\n", sort (lines()));
-cmp 'bar.git/config: bare = true
+cmp $t, 'bar.git/config: bare = true
bar.git/config:[foo]
-foo.git/config: bare = true
foo.git/config: bar = f1
+foo.git/config: bare = true
foo.git/config:[foo]
-frob.git/config: bare = true
frob.git/config: bar = none
+frob.git/config: bare = true
frob.git/config:[foo]
gitolite-admin.git/config: bare = true
testing.git/config: bar = dft
testing.git/config: bare = true
-testing.git/config:[foo]
-';
+testing.git/config:[foo]';
try "cd $od; ok";
@@ -170,21 +173,20 @@ try "
try "
cd $rb; ok
- egrep foo\\|bar *.git/config | sort
- find . -name config | xargs egrep foo\\|bar | sort
+ find . -name config | xargs egrep foo\\|bar
";
+$t = join("\n", sort (lines()));
-cmp './bar/u2/one.git/config: bare = true
-./bar/u2/one.git/config: bar = one
+cmp $t, './bar/u2/one.git/config: bar = one
+./bar/u2/one.git/config: bare = true
./bar/u2/one.git/config:[foo]
-./foo.git/config: bare = true
./foo.git/config: bar = f1
+./foo.git/config: bare = true
./foo.git/config:[foo]
-./frob.git/config: bare = true
./frob.git/config: bar = f1
+./frob.git/config: bare = true
./frob.git/config:[foo]
./gitolite-admin.git/config: bare = true
./testing.git/config: bar = dft
./testing.git/config: bare = true
-./testing.git/config:[foo]
-';
+./testing.git/config:[foo]';
diff --git a/t/partial-copy.t b/t/partial-copy.t
index 6b8dfdc..5bff843 100755
--- a/t/partial-copy.t
+++ b/t/partial-copy.t
@@ -90,20 +90,20 @@ try "
tc u4n1 u4n2
PUSH u4 next; ok
/To .*/foo.git/
- /new branch\\] ca3787119b7e8b9914bc22c939cefc443bc308da -> br-\\d+/
+ /new branch\\] ca3787119b7e8b9914bc22c939cefc443bc308da -> refs/partial/br-\\d+/
/file:///foo-pc/
/52c7716..ca37871 next -> next/
tag u4/nexttag; glt push u4 --tags
/To file:///foo-pc/
/\\[new tag\\] u4/nexttag -> u4/nexttag/
- /\\[new branch\\] ca3787119b7e8b9914bc22c939cefc443bc308da -> br-\\d+/
+ /\\[new branch\\] ca3787119b7e8b9914bc22c939cefc443bc308da -> refs/partial/br-\\d+/
checkout master
checkout -b dev/u4/u4master
tc devu4m1 devu4m2
PUSH u4 HEAD; ok
/To .*/foo.git/
- /new branch\\] 228353950557ed1eb13679c1fce4d2b4718a2060 -> br-\\d+/
+ /new branch\\] 228353950557ed1eb13679c1fce4d2b4718a2060 -> refs/partial/br-\\d+/
/file:///foo-pc/
/new branch.* HEAD -> dev/u4/u4master/