git-notify: Make the state file group writable

"Holger Weiss" <[email protected]>
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
 Module: nagiosplug
 Branch: master
 Commit: e2ba9ba91fbfcad53892c7ecfb1842dd9e62962a
 Author: Holger Weiss <[email protected]>
   Date: Mon Oct 26 02:41:51 2009 +0100
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=e2ba9ba

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.

---

 tools/git-notify |    7 +++++++
 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" ) || "";
 # the state file we use (can be changed with the -t option)
 my $state_file = git_config( "notify.statefile" ) || "/var/tmp/git-notify.state";
 
+# umask for creating the state file (can be set with -U option)
+my $mode_mask = git_config( "notify.umask" ) || 002;
+
 # Extra options to git rev-list
 my @revlist_options;
 
@@ -91,6 +94,7 @@ sub usage()
     print "   -s bytes  Set the maximum diff size in bytes (-1 for no limit)\n";
     print "   -t file   Set the file to use for reading and saving state\n";
     print "   -u url    Set the URL to the gitweb browser\n";
+    print "   -U mask   Set the umask for creatung the state file\n";
     print "   -i branch If at least one -i is given, report only for specified branches\n";
     print "   -x branch Exclude changes to the specified branch from reports\n";
     print "   -X        Exclude merge commits\n";
@@ -270,6 +274,7 @@ sub parse_options()
         elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; }
         elsif ($arg eq '-t') { $state_file = shift @ARGV; }
         elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; }
+        elsif ($arg eq '-U') { $mode_mask = shift @ARGV; }
         elsif ($arg eq '-i') { push @include_list, shift @ARGV; }
         elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; }
         elsif ($arg eq '-X') { push @revlist_options, "--no-merges"; }
@@ -562,6 +567,8 @@ sub send_all_notices($$$)
 
 parse_options();
 
+umask( $mode_mask );
+
 # append repository path to URL
 $gitweb_url .= "/$repos_name.git" if $gitweb_url;
 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.