From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1ECB21F64F for ; Thu, 6 Jun 2024 07:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1717659857; bh=I20UgcSp8jJtzA5qrxgUyofsB3r0LGasbmIzBFFdvIk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tI3vj5KJxW1QFEjcJUPzS4uO7GkmH9tqKQLVYmj+TtBKXeOney1P+oDSswg3v5qna hEH7Mru8hmEVwtbtzgYWFnp5bL9xMaS0aI/KffRN5I9jClecSwjZeknrZc1I9qJIvb HMPg1sHR+VK2jRlWQZtLIsYDtC/f8FkO59lGXB6I= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/5] git: decouple git_version from git_exe Date: Thu, 6 Jun 2024 07:44:13 +0000 Message-ID: <20240606074416.3900983-3-e@80x24.org> In-Reply-To: <20240606074416.3900983-1-e@80x24.org> References: <20240606074416.3900983-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: No need to check for the git version number unless we actually want it. --- lib/PublicInbox/Git.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 6b722023..32c11a59 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -61,7 +61,10 @@ sub git_exe () { return $GIT_EXE if $now < $next_check; $next_check = $now + 10; $GIT_EXE = which('git') // die "git not found in $ENV{PATH}"; - my @st = stat(_) or die "stat($GIT_EXE): $!"; # can't do HiRes w/ _ +} + +sub git_version () { + my @st = stat(git_exe) or die "stat($GIT_EXE): $!"; my $st = pack('dd', $st[0], $st[1]); if ($st ne $EXE_ST) { my $v = run_qx([ $GIT_EXE, '--version' ]); @@ -71,11 +74,6 @@ sub git_exe () { $GIT_VER = eval("v$1") // die "BUG: bad vstring: $1 ($v)"; $EXE_ST = $st; } - $GIT_EXE; -} - -sub git_version () { - git_exe; $GIT_VER; }