]> Lady’s Gitweb - HOMEDIR/commitdiff
Try to detect bare repositories with git
authorLady <redacted>
Sun, 5 Apr 2026 20:06:43 +0000 (16:06 -0400)
committerLady <redacted>
Sun, 5 Apr 2026 20:06:43 +0000 (16:06 -0400)
If a directory has a `refs´ subdirectory, it should be assumed that it
  is a Git directory (either a bare one or a `.git´ directory in a
  working tree).
These cases are now treated equivalently to those where a `.git´ file
  or directory is present.

Ideally, this detection would walk the file tree upward (at least
  until `${PSEUDDIR}´ is encountered).
But the current behaviour is good enough for the immediate usecases,
  namely “updating git submodules” and “operating in bare git
  directories”, which do not require further subdirectory support.

Message-type: text/lesml

sh/git.sh

index 4c82e98c300465f36df873c46fb07f51c19e298687235f3a1d3569868abd1199..d2e37102c24a67f5fd5dd0767caf05c5bfb43eee9a6eed25038157cac646586c 100755 (executable)
--- a/sh/git.sh
+++ b/sh/git.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env sh
-# @(#)🏠📂 HOMEDIR       sh/git.sh       2026-04-05T20:05:34Z
+# @(#)🏠📂 HOMEDIR       sh/git.sh       2026-04-05T20:06:43Z
 # SPDX-FileCopyrightText: 2026 Lady <https://www.ladys.computer/about/#lady>
 # SPDX-License-Identifier: MPL-2.0
 
@@ -179,10 +179,12 @@ else :
     "${cmd_TOUCH}" "${configfile}"
   fi
 
-## If a `.git´ file or directory exists, Git is simply provided with
-## the correct configuration but is otherwise called normally.
+## If a `.git´ file or directory exists or there is a `refs´ directory,
+##   Git is provided with the correct configuration but is otherwise
+##   called normally.
 
-  if "${cmd_TEST}" -e "${realpwd}"'/.git'
+  if "${cmd_TEST}" -e "${realpwd}"'/.git' ||
+    "${cmd_TEST}" -d "${realpwd}"'/refs'
   then :
     "${cmd_GIT}" -c "include.path=${configfile}" "$@"
 
This page took 0.315458 seconds and 4 git commands to generate.