summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2017-09-25 15:57:47 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2017-09-25 15:58:55 +0530
commitc3ae5995f7d439dde8e764229865a37f0764e544 (patch)
tree3be30b5154a8bba5004f4d4d16e17d1a4bb3ce65 /src
parentcf423a6a74b398eaa1dd67966ab2e02ff422274a (diff)
optimise the single-repo POST_CREATE cases a bit...
...I was lazily letting them run over ALL repos. (And I am still lazy because I did not do one of them yet; see comments in that file).
Diffstat (limited to 'src')
-rwxr-xr-xsrc/triggers/post-compile/update-git-daemon-access-list8
-rwxr-xr-xsrc/triggers/post-compile/update-gitweb-access-list22
-rwxr-xr-xsrc/triggers/post-compile/update-gitweb-daemon-from-options4
3 files changed, 28 insertions, 6 deletions
diff --git a/src/triggers/post-compile/update-git-daemon-access-list b/src/triggers/post-compile/update-git-daemon-access-list
index 6110263..b1cf460 100755
--- a/src/triggers/post-compile/update-git-daemon-access-list
+++ b/src/triggers/post-compile/update-git-daemon-access-list
@@ -14,7 +14,13 @@ use warnings;
my $EO = "git-daemon-export-ok";
my $RB = $rc{GL_REPO_BASE};
-for my $d (`gitolite list-phy-repos | gitolite access % daemon R any`) {
+my $cmd = "gitolite list-phy-repos";
+if ( @ARGV and $ARGV[0] eq 'POST_CREATE' ) {
+ # only one repo to do
+ $cmd = "echo $ARGV[1]";
+}
+
+for my $d (`$cmd | gitolite access % daemon R any`) {
my @F = split "\t", $d;
if ($F[2] =~ /DENIED/) {
unlink "$RB/$F[0].git/$EO";
diff --git a/src/triggers/post-compile/update-gitweb-access-list b/src/triggers/post-compile/update-gitweb-access-list
index e3dae80..4085d59 100755
--- a/src/triggers/post-compile/update-gitweb-access-list
+++ b/src/triggers/post-compile/update-gitweb-access-list
@@ -18,11 +18,23 @@ plf=`gitolite query-rc GITWEB_PROJECTS_LIST`
tmpfile=`mktemp $plf.tmp_XXXXXXXX`
rm -f $tmpfile;
-(
- gitolite list-phy-repos | gitolite access % gitweb R any | grep -v DENIED
- gitolite list-phy-repos | gitolite git-config -r % gitweb\\.
-) |
- cut -f1 | sort -u | sed -e 's/$/.git/' > $tmpfile
+if [ "$1" = "POST_CREATE" ] && [ -n "$2" ]
+then
+ # just one to be done
+ repo="$2"
+ grep -v "^$repo.git$" $plf > $tmpfile
+ if gitolite access -q $repo gitweb R any || gitolite git-config -q -r $repo gitweb\\.
+ then
+ echo "$repo.git" >> $tmpfile
+ fi
+else
+ # all of them
+ (
+ gitolite list-phy-repos | gitolite access % gitweb R any | grep -v DENIED
+ gitolite list-phy-repos | gitolite git-config -r % gitweb\\.
+ ) |
+ cut -f1 | sort -u | sed -e 's/$/.git/' > $tmpfile
+fi
[ -f $plf ] && perl -e "chmod ( ( (stat('$plf'))[2] & 07777 ), '$tmpfile')"
mv $tmpfile $plf
diff --git a/src/triggers/post-compile/update-gitweb-daemon-from-options b/src/triggers/post-compile/update-gitweb-daemon-from-options
index fb5b083..1f5fd26 100755
--- a/src/triggers/post-compile/update-gitweb-daemon-from-options
+++ b/src/triggers/post-compile/update-gitweb-daemon-from-options
@@ -1,5 +1,9 @@
#!/bin/sh
+# TODO: look at the commit in which *this* line was added, and see the changes
+# to the other scripts. We need to make those changes here also, but I'm too
+# lazy right now. Plus I'm not even sure if anyone is using this!
+
# Update git-daemon and gitweb access using 'option' lines instead of special
# usernames.