git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 1/3] Don't diff empty tree on branch creation in paranoid update hook
Date: Sun, 25 May 2008 22:17:57 -0400	[thread overview]
Message-ID: <20080526021757.GA29990@spearce.org> (raw)

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>
---

 I had this series of 3 patches laying around that I forgot to send.
 They have been in production for a while (~5 months) and are
 safe to apply.  Funny what you find laying around in your topic
 branches sometimes...

 contrib/hooks/update-paranoid |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/contrib/hooks/update-paranoid b/contrib/hooks/update-paranoid
index 068fa37..6e0d97c 100644
--- a/contrib/hooks/update-paranoid
+++ b/contrib/hooks/update-paranoid
@@ -225,14 +225,12 @@ sub load_diff ($) {
 		local $/ = "\0";
 		my %this_diff;
 		if ($base =~ /^0{40}$/) {
-			open(T,'-|','git','ls-tree',
-				'-r','--name-only','-z',
-				$new) or return undef;
-			while (<T>) {
-				chop;
-				$this_diff{$_} = 'A';
-			}
-			close T or return undef;
+			# 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',
-- 
1.5.5.1.501.gefb4

                 reply	other threads:[~2008-05-26  2:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080526021757.GA29990@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).