new mirror function: 'status all all'
[gitolite.git] / src / VREF / lock
blob0fc7681d11556874ce64f799f056d059e4de37fc
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 use lib $ENV{GL_LIBDIR};
6 use Gitolite::Common;
8 # gitolite VREF to lock and unlock (binary) files. Requires companion command
9 # 'lock' to be enabled; see doc/locking.mkd for details.
11 # ----------------------------------------------------------------------
13 # see gitolite docs for what the first 7 arguments mean
15 die "not meant to be run manually" unless $ARGV[6];
17 my $ff = "$ENV{GL_REPO_BASE}/$ENV{GL_REPO}.git/gl-locks";
18 exit 0 unless -f $ff;
20 our %locks;
21 my $t = slurp($ff);
22 eval $t;
23 _die "do '$ff' failed with '$@', contact your administrator" if $@;
25 my ( $oldtree, $newtree, $refex ) = @ARGV[ 3, 4, 6 ];
27 for my $file (`git diff --name-only $oldtree $newtree`) {
28 chomp($file);
30 if ( $locks{$file} and $locks{$file}{USER} ne $ENV{GL_USER} ) {
31 print "$refex '$file' locked by '$locks{$file}{USER}'";
32 last;
36 exit 0