From 6a11e864b5832624c2e2de9747159de6a74b97dd Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sat, 30 Dec 2017 06:49:19 -0800 Subject: [PATCH] jobd.pl: treat a disabled mirror like .bypass_fetch It's possible to disable a mirror by prepending the value "disabled " to the gitweb.baseurl config setting. This does not (yet) happen automatically, but it can be done manually. Rather than having update.sh run and choke on an empty URL or one with withspace in it, have jobd.pl treat that as a ".bypass_fetch" mirror instead. Signed-off-by: Kyle J. McKay --- jobd/jobd.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jobd/jobd.pl b/jobd/jobd.pl index b00d23f..32b0d73 100755 --- a/jobd/jobd.pl +++ b/jobd/jobd.pl @@ -47,7 +47,8 @@ sub update_project { if ($gc_only || $needs_gc_only || -e "$projpath/.nofetch" || -e "$projpath/.bypass" || - -e "$projpath/.bypass_fetch") { + -e "$projpath/.bypass_fetch" || + is_mirror_disabled($p)) { job_skip($job); return setup_gc($job); } @@ -179,6 +180,16 @@ sub is_operation_uptodate { (time - $unix_ts) <= $threshold ? $timestamp : undef; } +sub is_mirror_disabled { + my ($project) = @_; + my $path = get_project_path($project); + my $baseurl = get_git_config($path, 'gitweb.baseurl'); + defined($baseurl) or $baseurl = ''; + $baseurl =~ s/^\s+//; + $baseurl =~ s/\s+$//; + return $baseurl eq "" || $baseurl =~ /\s/ || $baseurl =~ /^disabled(?:\s|$)/i; +} + sub is_svn_clone { my ($project) = @_; my $path = get_project_path($project); -- 2.11.4.GIT