From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Roskin Subject: [PATCH] Calculate $commitsha1 in update() only when needed Date: Sat, 08 Dec 2007 00:07:46 -0500 Message-ID: <20071208050745.29462.74137.stgit@dv.roinet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sat Dec 08 06:08:11 2007 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1J0rv8-0007c5-7j for gcvg-git-2@gmane.org; Sat, 08 Dec 2007 06:08:10 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751427AbXLHFHs (ORCPT ); Sat, 8 Dec 2007 00:07:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751718AbXLHFHs (ORCPT ); Sat, 8 Dec 2007 00:07:48 -0500 Received: from c60.cesmail.net ([216.154.195.49]:5119 "EHLO c60.cesmail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751001AbXLHFHs (ORCPT ); Sat, 8 Dec 2007 00:07:48 -0500 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 08 Dec 2007 00:07:46 -0500 Received: from dv.roinet.com (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id A812E618FE1 for ; Sat, 8 Dec 2007 00:07:46 -0500 (EST) User-Agent: StGIT/0.13 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: This suppresses unhelpful error messages from git rev-parse during checkout if the module doesn't exist. Signed-off-by: Pavel Roskin --- git-cvsserver.perl | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/git-cvsserver.perl b/git-cvsserver.perl index ecded3b..409b301 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -2427,9 +2427,6 @@ sub update # first lets get the commit list $ENV{GIT_DIR} = $self->{git_path}; - my $commitsha1 = `git rev-parse $self->{module}`; - chomp $commitsha1; - my $commitinfo = `git cat-file commit $self->{module} 2>&1`; unless ( $commitinfo =~ /tree\s+[a-zA-Z0-9]{40}/ ) { @@ -2440,8 +2437,13 @@ sub update my $git_log; my $lastcommit = $self->_get_prop("last_commit"); - if (defined $lastcommit && $lastcommit eq $commitsha1) { # up-to-date - return 1; + if (defined $lastcommit) { + my $commitsha1 = `git rev-parse $self->{module}`; + chomp $commitsha1; + + if ($lastcommit eq $commitsha1) { # up-to-date + return 1; + } } # Start exclusive lock here...