summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2009-10-26 01:41:51 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2009-10-26 01:41:51 (GMT)
commite2ba9ba91fbfcad53892c7ecfb1842dd9e62962a (patch)
treedd2304f09400b909d73c7dc60b977658518afd4b /tools
parent90ab3e6042add5b0500a100bd4929bb516f6f347 (diff)
downloadmonitoring-plugins-e2ba9ba91fbfcad53892c7ecfb1842dd9e62962a.tar.gz
git-notify: Make the state file group writable
For shared repositories, the state file used by git-notify should usually be group writable, so we now set the umask to 0002 by default. This can be adjusted by setting the "notify.umask" configuration key or by using the "-U" option on the command line.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/git-notify7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/git-notify b/tools/git-notify
index 68456fb..97bd2ad 100755
--- a/tools/git-notify
+++ b/tools/git-notify
@@ -78,6 +78,9 @@ my @exclude_list = split /\s+/, git_config( "notify.exclude" ) || "";
78# the state file we use (can be changed with the -t option) 78# the state file we use (can be changed with the -t option)
79my $state_file = git_config( "notify.statefile" ) || "/var/tmp/git-notify.state"; 79my $state_file = git_config( "notify.statefile" ) || "/var/tmp/git-notify.state";
80 80
81# umask for creating the state file (can be set with -U option)
82my $mode_mask = git_config( "notify.umask" ) || 002;
83
81# Extra options to git rev-list 84# Extra options to git rev-list
82my @revlist_options; 85my @revlist_options;
83 86
@@ -91,6 +94,7 @@ sub usage()
91 print " -s bytes Set the maximum diff size in bytes (-1 for no limit)\n"; 94 print " -s bytes Set the maximum diff size in bytes (-1 for no limit)\n";
92 print " -t file Set the file to use for reading and saving state\n"; 95 print " -t file Set the file to use for reading and saving state\n";
93 print " -u url Set the URL to the gitweb browser\n"; 96 print " -u url Set the URL to the gitweb browser\n";
97 print " -U mask Set the umask for creatung the state file\n";
94 print " -i branch If at least one -i is given, report only for specified branches\n"; 98 print " -i branch If at least one -i is given, report only for specified branches\n";
95 print " -x branch Exclude changes to the specified branch from reports\n"; 99 print " -x branch Exclude changes to the specified branch from reports\n";
96 print " -X Exclude merge commits\n"; 100 print " -X Exclude merge commits\n";
@@ -270,6 +274,7 @@ sub parse_options()
270 elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; } 274 elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; }
271 elsif ($arg eq '-t') { $state_file = shift @ARGV; } 275 elsif ($arg eq '-t') { $state_file = shift @ARGV; }
272 elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; } 276 elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; }
277 elsif ($arg eq '-U') { $mode_mask = shift @ARGV; }
273 elsif ($arg eq '-i') { push @include_list, shift @ARGV; } 278 elsif ($arg eq '-i') { push @include_list, shift @ARGV; }
274 elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; } 279 elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; }
275 elsif ($arg eq '-X') { push @revlist_options, "--no-merges"; } 280 elsif ($arg eq '-X') { push @revlist_options, "--no-merges"; }
@@ -562,6 +567,8 @@ sub send_all_notices($$$)
562 567
563parse_options(); 568parse_options();
564 569
570umask( $mode_mask );
571
565# append repository path to URL 572# append repository path to URL
566$gitweb_url .= "/$repos_name.git" if $gitweb_url; 573$gitweb_url .= "/$repos_name.git" if $gitweb_url;
567 574