From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id C34501F9F4 for ; Tue, 16 Nov 2021 12:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236073AbhKPMGK (ORCPT ); Tue, 16 Nov 2021 07:06:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235751AbhKPMEg (ORCPT ); Tue, 16 Nov 2021 07:04:36 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52CE6C06122A for ; Tue, 16 Nov 2021 04:00:45 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id r8so36984856wra.7 for ; Tue, 16 Nov 2021 04:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GZey/9m9V78NBW8cceKwNGYYQTDQ7ngcgVlzXdWjcu8=; b=b+vpS8zRPHsuySrm2DvFAIKDFlhFwELyaXnRt2hTgw2Pn+dyp6qr5tdZNr3IyvVLQE ubLn2C0s6yNjJQJY7YuqzpbNTfO4AzM5NqkmQxL41sNsuik1G0QuS97In1IYQloCrc0W o5CuvBHDCRk9p34kj8sed+KkqNt+46PoRlGfMShvhKXonNJHLfIGOLdEcoHi5glhOt4Y TRJl8SGG90s5Mp5UAhXCPPCz0Jt/iDOnScbRgTaQzaqTisP3RoNVrNyUTNqhUo3HHPuN VuHr7rXIWbp2HGotCW3/KaFCM1qGYH6FMFHapan5lvfMypYgLfAZLTeITV62Jd5ZxB9E zX4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GZey/9m9V78NBW8cceKwNGYYQTDQ7ngcgVlzXdWjcu8=; b=7FAbW9SnqB9kxR9Z4Q4lXeLVgBpmyJFyb9r62AuTrasfclh5KkGVpcTpEF3/17PYz5 mCGXE4ii2dS3AzUmErQMFgOUh9HdL4O37IX25gC6AEsQJBDEPOsP5u9Hcx+D3nQC7GwK NGz+3NV/H+i6vpaarRpS4Q+JQo/2B+sQ2laGfjZqsgUiK86KwxHa60w4WHqnlZde0BLP 5g0QigPpOoxiCaXWKRbp3jfanmPcvO6mV1F/ZYfJQnuFnwU/Iy/oE3lkSjwip4lPDvR7 yRbidw1i8hXoaPtHMm8Ugv4j1Ew0DQLdVLXIXpYKjSJI2IiVzWYQDRqAvbKvAGWwOS4O 9lBA== X-Gm-Message-State: AOAM532cokiFGoq8ZurwbnpBFn8ksh9CYyGCAeA7ikIuSPlvbL/vpVCy 0XcIwtBZ2vhvWtdgARWy4Ycm21OB7DAUfw== X-Google-Smtp-Source: ABdhPJx9m4xmQ0ZOkuFaJLg2fcFHTf83ZRu2sYQcT+AxxfkPeu74/+XyFh5GnHRNI06B/0XUI2uKmg== X-Received: by 2002:a05:6000:1568:: with SMTP id 8mr8722037wrz.76.1637064043627; Tue, 16 Nov 2021 04:00:43 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id k37sm2427922wms.21.2021.11.16.04.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 04:00:43 -0800 (PST) From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= To: git@vger.kernel.org Cc: Junio C Hamano , Phillip Wood , Jeff King , Dan Jacques , Eric Wong , Jonathan Nieder , Mike Hommey , =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Subject: [PATCH v3 11/23] Makefile: stop needing @@GIT_VERSION@@ in *.perl scripts Date: Tue, 16 Nov 2021 13:00:11 +0100 Message-Id: X-Mailer: git-send-email 2.34.0.795.g1e9501ab396 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the hardcoding of @@GIT_VERSION@@ in generated *.perl scripts to instead shell out to "git version". This means that we can stop re-building during development every time the HEAD changes. These codepaths are not "hot", so shelling out to get the version shouldn't matter to users, in the one case where it potentially would in send-email (the loop for each E-Mail we send) we now cache the value, so we'll only retrieve it once. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 2 +- git-cvsserver.perl | 6 +++--- git-send-email.perl | 7 ++----- git-svn.perl | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c698c5b058a..8205614c6ec 100644 --- a/Makefile +++ b/Makefile @@ -2333,7 +2333,7 @@ PERL_HEADER_TEMPLATE = perl/header_templates/runtime_prefix.template.pl perl_localedir_SQ = endif -$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE +$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER $(QUIET_GEN) \ sed -e '1{' \ -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 64319bed43f..76f0e8bbbef 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -26,8 +26,6 @@ use File::Basename; use Getopt::Long qw(:config require_order no_ignore_case); -my $VERSION = '@@GIT_VERSION@@'; - my $log = GITCVS::log->new(); my $cfg; @@ -126,7 +124,9 @@ or die $usage; if ($state->{version}) { - print "git-cvsserver version $VERSION\n"; + my $version = qx[git version]; + $version =~ s/^(git)\b/$1-cvsserver/; + print $version; exit; } if ($state->{help}) { diff --git a/git-send-email.perl b/git-send-email.perl index 5262d88ee32..041cd2fb96d 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1468,6 +1468,7 @@ sub file_name_is_absolute { # # If an error occurs sending the email, this just dies. +my $gitversion; sub send_message { my @recipients = unique_email_list(@to); @cc = (grep { my $cc = extract_valid_address_or_die($_); @@ -1478,11 +1479,6 @@ sub send_message { @recipients = unique_email_list(@recipients,@cc,@initial_bcc); @recipients = (map { extract_valid_address_or_die($_) } @recipients); my $date = format_2822_time($time++); - my $gitversion = '@@GIT_VERSION@@'; - if ($gitversion =~ m/..GIT_VERSION../) { - $gitversion = Git::version(); - } - my $cc = join(",\n\t", unique_email_list(@cc)); my $ccline = ""; if ($cc ne '') { @@ -1497,6 +1493,7 @@ sub send_message { Message-Id: $message_id "; if ($use_xmailer) { + $gitversion ||= Git::version(); $header .= "X-Mailer: git-send-email $gitversion\n"; } if ($in_reply_to) { diff --git a/git-svn.perl b/git-svn.perl index be987e316f9..727431412be 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -9,7 +9,6 @@ $_revision $_repository $_q $_authors $_authors_prog %users/; $AUTHOR = 'Eric Wong '; -$VERSION = '@@GIT_VERSION@@'; use Carp qw/croak/; use File::Basename qw/dirname basename/; @@ -47,6 +46,7 @@ command_close_bidi_pipe get_record ); +$VERSION = Git::version(); BEGIN { Memoize::memoize 'Git::config'; -- 2.34.0.795.g1e9501ab396