]> Lady’s Gitweb - HOMEDIR/commitdiff
Use command to find the default Git location 0.1.2
authorLady <redacted>
Sun, 5 Apr 2026 20:04:14 +0000 (16:04 -0400)
committerLady <redacted>
Sun, 5 Apr 2026 20:04:14 +0000 (16:04 -0400)
This is better than presuming a specific install location, which
  probably varies by platform.

Message-type: text/lesml

sh/git.sh

index f6dc5e9abdf51e930c3b48772b0f1572ac0dff75bc719223d91e15a233c971e4..aef6cc0aa8c43f7d5b59f147115e9aa216cd7b12d2b004fc64ba18971961464e 100755 (executable)
--- a/sh/git.sh
+++ b/sh/git.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env sh
-# @(#)🏠📂 HOMEDIR       sh/git.sh       2026-04-05T19:34:02Z
+# @(#)🏠📂 HOMEDIR       sh/git.sh       2026-04-05T20:04:14Z
 # SPDX-FileCopyrightText: 2026 Lady <https://www.ladys.computer/about/#lady>
 # SPDX-License-Identifier: MPL-2.0
 
@@ -43,8 +43,13 @@ set -o 'errexit'
 ##
 ## As this script is expected to override `git´ in the `${PATH}´, the
 ##   actual path to the Git binary must be used.
+## Assuming Git is in the usual location, this can be found with
+##   `command -pv git´.
 
-: "${cmd_GIT:=/usr/bin/git}"
+defaultgit="$(
+  command -pv git
+)"
+: "${cmd_GIT:=${defaultgit}}"
 : "${cmd_MKDIR:=mkdir}"
 : "${cmd_PRINTF:=printf}"
 : "${cmd_PWD:=pwd}"
This page took 0.35818 seconds and 4 git commands to generate.