{"thread":{"id":"13661","subject":"[PATCH 1/3] Don't diff empty tree on branch creation in paranoid update hook","startedAt":"2008-05-26T02:17:57Z","lastAt":"2008-05-26T02:17:57Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"77732","messageId":"20080526021757.GA29990@spearce.org","threadId":"13661","inReplyTo":null,"subject":"[PATCH 1/3] Don't diff empty tree on branch creation in paranoid update hook","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-05-26T02:17:57Z","receivedAt":"2008-05-26T02:17:57Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Listing all files in a branch during branch creation is silly;\nthe user's file-level ACLs probably don't mean anything at this\npoint.  We now treat the base case of 0{40} as an empty diff,\nas this happens only when the user is creating the branch and\nthere are file level ACLs that diff against the old value of\nthe branch.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n\n I had this series of 3 patches laying around that I forgot to send.\n They have been in production for a while (~5 months) and are\n safe to apply.  Funny what you find laying around in your topic\n branches sometimes...\n\n contrib/hooks/update-paranoid |   14 ++++++--------\n 1 files changed, 6 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/hooks/update-paranoid b/contrib/hooks/update-paranoid\nindex 068fa37..6e0d97c 100644\n--- a/contrib/hooks/update-paranoid\n+++ b/contrib/hooks/update-paranoid\n@@ -225,14 +225,12 @@ sub load_diff ($) {\n \t\tlocal $/ = \"\\0\";\n \t\tmy %this_diff;\n \t\tif ($base =~ /^0{40}$/) {\n-\t\t\topen(T,'-|','git','ls-tree',\n-\t\t\t\t'-r','--name-only','-z',\n-\t\t\t\t$new) or return undef;\n-\t\t\twhile (<T>) {\n-\t\t\t\tchop;\n-\t\t\t\t$this_diff{$_} = 'A';\n-\t\t\t}\n-\t\t\tclose T or return undef;\n+\t\t\t# Don't load the diff at all; we are making the\n+\t\t\t# branch and have no base to compare to in this\n+\t\t\t# case.  A file level ACL makes no sense in this\n+\t\t\t# context.  Having an empty diff will allow the\n+\t\t\t# branch creation.\n+\t\t\t#\n \t\t} else {\n \t\t\topen(T,'-|','git','diff-tree',\n \t\t\t\t'-r','--name-status','-z',\n-- \n1.5.5.1.501.gefb4\n"}]}