aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2016-11-14 15:13:17 -0600
committerAndy Doan <andy.doan@linaro.org>2016-11-14 15:13:17 -0600
commitd8adcd58301f49d9251702c09938bb050f2aff5a (patch)
tree60bef08379a5409c09b13a0a14a1d4504579818e
parent59a56a55ab21222ea6cbf0b59c5a22e89c3d4ff0 (diff)
downloadlinaro-git-tools-d8adcd58301f49d9251702c09938bb050f2aff5a.tar.gz
cgit: add a script that will show every repository a user can view
This is needed for cgit to safely handle dev-private-git.linaro.org Change-Id: I66de59f797ddb5378855ba3de6ea290c54d009ea
-rwxr-xr-xgitolite-tools/user_repos.pl31
1 files changed, 31 insertions, 0 deletions
diff --git a/gitolite-tools/user_repos.pl b/gitolite-tools/user_repos.pl
new file mode 100755
index 0000000..3274ab3
--- /dev/null
+++ b/gitolite-tools/user_repos.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+## Lists every repository a given user can read
+
+use strict;
+use warnings;
+
+$ENV{GL_USER} = $ARGV[0];
+
+BEGIN {
+ $ENV{HOME} = "/home/git";
+ $ENV{GL_BINDIR} = "/home/git/gitolite/src";
+ $ENV{GL_LIBDIR} = "/home/git/gitolite/src/lib";
+};
+
+# Pull in gitolite's perl API module. Among other things, this also sets the
+# GL_REPO_BASE environment variable.
+use lib $ENV{GL_LIBDIR};
+use Gitolite::Rc;
+use Gitolite::Common;
+use Gitolite::Conf::Load;
+use Gitolite::Easy;
+
+_chdir( $rc{GL_REPO_BASE} );
+my $repos = list_phy_repos(1);
+
+for my $repo (@$repos) {
+ if (can_read($repo)) {
+ print $repo . ".git\n";
+ }
+}