dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] git: decouple git_version from git_exe
@ 2024-06-05 21:35 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-06-05 21:35 UTC (permalink / raw)
  To: spew

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-05 21:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 21:35 [PATCH] git: decouple git_version from git_exe Eric Wong

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 read-only IMAP folder(s) and NNTP newsgroup(s).