From: Lady Date: Sun, 5 Apr 2026 20:05:34 +0000 (-0400) Subject: Fix submodule handling X-Git-Tag: 0.1.3 X-Git-Url: https://git.ladys.computer/HOMEDIR/commitdiff_plain/refs/tags/0.1.3 Fix submodule handling Submodules are created with a `.git´ directory and so should not use the `--git-dir´ or `--work-tree´ options. Message-type: text/lesml --- diff --git a/sh/git.sh b/sh/git.sh index aef6cc0..4c82e98 100755 --- a/sh/git.sh +++ b/sh/git.sh @@ -1,5 +1,5 @@ #!/usr/bin/env sh -# @(#)🏠📂 HOMEDIR sh/git.sh 2026-04-05T20:04:14Z +# @(#)🏠📂 HOMEDIR sh/git.sh 2026-04-05T20:05:34Z # SPDX-FileCopyrightText: 2026 Lady # SPDX-License-Identifier: MPL-2.0 @@ -163,7 +163,6 @@ then : else : configfile="${path_REPODIR}"'/'"${pseudname}"'/.gitconfig' - baredir="${path_REPODIR}/${reponame}.git" ## If the pseud directory does not exist within `${path_REPODIR}´, it ## is created. @@ -180,25 +179,39 @@ 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 "${cmd_TEST}" -e "${realpwd}"'/.git' + then : + "${cmd_GIT}" -c "include.path=${configfile}" "$@" + +## Otherwise, the Git directory must be found or created and then +## provided to Git. + + else : + baredir="${path_REPODIR}/${reponame}.git" + ## If the repository does not already exist, it is initialized with a ## Sha·256 format. - if "${cmd_TEST}" ! -d "${baredir}" - then : - cd -P "${workdir}" - "${cmd_GIT}" \ - -c "include.path=${configfile}" \ - --git-dir="${baredir}" init \ - --object-format=sha256 - cd -P "${OLDPWD}" - fi + if "${cmd_TEST}" ! -d "${baredir}" + then : + cd -P "${workdir}" + "${cmd_GIT}" \ + -c "include.path=${configfile}" \ + --git-dir="${baredir}" init \ + --object-format=sha256 + cd -P "${OLDPWD}" + fi ## Finally, Git is run with the appropriate Git directory and work ## tree. - "${cmd_GIT}" \ - -c "include.path=${configfile}" \ - --git-dir="${baredir}" \ - --work-tree="${workdir}" \ - "$@" + "${cmd_GIT}" \ + -c "include.path=${configfile}" \ + --git-dir="${baredir}" \ + --work-tree="${workdir}" \ + "$@" + fi fi