summaryrefslogtreecommitdiff
path: root/git-cvsserver.perl
diff options
context:
space:
mode:
authorMartin Langhoff <martin@catalyst.net.nz>2007-01-09 02:10:32 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-09 05:44:07 (GMT)
commit49fb940e4025f36953cd938576ec8306335c6cd0 (patch)
treea149cce3527f14442c8ced92e358bfc37c4a4154 /git-cvsserver.perl
parent041e69c9984972c51cbf21a70b0327d83dee41db (diff)
downloadgit-49fb940e4025f36953cd938576ec8306335c6cd0.zip
git-49fb940e4025f36953cd938576ec8306335c6cd0.tar.gz
git-49fb940e4025f36953cd938576ec8306335c6cd0.tar.bz2
cvsserver: detect early of we are up to date and avoid costly rev-list
if the SHA1 of our head matches the last SHA1 seen in the DB, avoid further processing. [jc: an "Oops, please amend" patch rolled in] Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-cvsserver.perl')
-rwxr-xr-xgit-cvsserver.perl9
1 files changed, 8 insertions, 1 deletions
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index df39512..eb98fa0 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -2184,7 +2184,10 @@ sub update
# first lets get the commit list
$ENV{GIT_DIR} = $self->{git_path};
- my $commitinfo = `git-cat-file commit $self->{module} 2>&1`;
+ 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}/ )
{
die("Invalid module '$self->{module}'");
@@ -2194,6 +2197,10 @@ sub update
my $git_log;
my $lastcommit = $self->_get_prop("last_commit");
+ if (defined $lastcommit && $lastcommit eq $commitsha1) { # up-to-date
+ return 1;
+ }
+
# Start exclusive lock here...
$self->{dbh}->begin_work() or die "Cannot lock database for BEGIN";