@matheusbsbs / matheus-bagliano / commits / 97561fff32
Fork 0

Don't diff empty tree on branch creation in paranoid update hook

Listing all files in a branch during branch creation is silly; the user's file-level ACLs probably don't mean anything at this point. We now treat the base case of 0{40} as an empty diff, as this happens only when the user is creating the branch and there are file level ACLs that diff against the old value of the branch. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed May 25, 2008 at 22:17 UTC 97561fff3263add59ec25207a0c5a635b28ce9b9
1 file changed +6 -8
contrib/hooks/update-paranoid
+6 -8
@@ -225,14 +225,12 @@ sub load_diff ($) {
225 local $/ = "\0";
226 my %this_diff;
227 if ($base =~ /^0{40}$/) {
228 - open(T,'-|','git','ls-tree',
229 - '-r','--name-only','-z',
230 - $new) or return undef;
231 - while (<T>) {
232 - chop;
233 - $this_diff{$_} = 'A';
234 - }
235 - close T or return undef;
228 + # Don't load the diff at all; we are making the
229 + # branch and have no base to compare to in this
230 + # case. A file level ACL makes no sense in this
231 + # context. Having an empty diff will allow the
232 + # branch creation.
233 + #
234 } else {
235 open(T,'-|','git','diff-tree',
236 '-r','--name-status','-z',