local $ENV{GIT_DIR} = shift;
my $br = shift;
my $fn = shift;
+ return unless git_value('rev-list','--max-count=1',$br,'--',$fn);
info "Loading $br:$fn";
open(I,'-|','git','cat-file','blob',"$br:$fn");
my $section = '';
my $d = $diff_cache{$base};
unless ($d) {
local $/ = "\0";
- open(T,'-|','git','diff-tree',
- '-r','--name-status','-z',
- $base,$new) or return undef;
my %this_diff;
- while (<T>) {
- my $op = $_;
- chop $op;
+ if ($base =~ /^0{40}$/) {
+ # Don't load the diff at all; we are making the
+ # branch and have no base to compare to in this
+ # case. A file level ACL makes no sense in this
+ # context. Having an empty diff will allow the
+ # branch creation.
+ #
+ } else {
+ open(T,'-|','git','diff-tree',
+ '-r','--name-status','-z',
+ $base,$new) or return undef;
+ while (<T>) {
+ my $op = $_;
+ chop $op;
- my $path = <T>;
- chop $path;
+ my $path = <T>;
+ chop $path;
- $this_diff{$path} = $op;
+ $this_diff{$path} = $op;
+ }
+ close T or return undef;
}
- close T or return undef;
$d = \%this_diff;
$diff_cache{$base} = $d;
}
deny "Bad old value $old" unless $old =~ /^[a-z0-9]{40}$/;
deny "Bad new value $new" unless $new =~ /^[a-z0-9]{40}$/;
deny "Cannot determine who you are." unless $this_user;
+grant "No change requested." if $old eq $new;
$repository_name = File::Spec->rel2abs($git_dir);
$repository_name =~ m,/([^/]+)(?:\.git|/\.git)$,;