new mirror function: 'status all all'
[gitolite.git] / src / commands / readme
blobcd9632f5fa76dd7d424cc289671c527df0c845be
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 use lib $ENV{GL_LIBDIR};
6 use Gitolite::Easy;
8 # README.html files work similar to "description" files. For further
9 # information see
10 # https://www.kernel.org/pub/software/scm/git/docs/gitweb.html
11 # under "Per-repository gitweb configuration".
13 =for usage
14 Usage: ssh git@host readme <repo>
15 ssh git@host readme <repo> rm
16 cat <filename> | ssh git@host readme <repo> set
18 Show, remove or set the README.html file for repo.
20 You need to have write access to the repo and the 'writer-is-owner' option
21 must be set for the repo, or it must be a user-created ('wild') repo and you
22 must be the owner.
23 =cut
25 usage() if not @ARGV or @ARGV < 1 or $ARGV[0] eq '-h';
27 my $repo = shift;
28 my $op = shift || '';
29 usage() if $op and $op ne 'rm' and $op ne 'set';
30 my $file = 'README.html';
32 #<<<
33 _die "you are not authorized" unless
34 ( not $op and can_read($repo) ) or
35 ( $op and owns($repo) ) or
36 ( $op and can_write($repo) and option( $repo, 'writer-is-owner' ) );
37 #>>>
39 if ( $op eq 'rm' ) {
40 unlink "$rc{GL_REPO_BASE}/$repo.git/$file";
41 } elsif ( $op eq 'set' ) {
42 textfile( file => $file, repo => $repo, prompt => '' );
43 } else {
44 print textfile( file => $file, repo => $repo );
47 __END__
49 The WRITER_CAN_UPDATE_README option is gone now; it applies to all the repos
50 in the system. Much better to add 'option writer-is-owner = 1' to repos or
51 repo groups that you want this to apply to.
53 This option is meant to cover desc, readme, and any other repo-specific text
54 file, so it's also a blunt instrument, though in a different dimension :-)