#!/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 <https://www.ladys.computer/about/#lady>
# SPDX-License-Identifier: MPL-2.0
else :
configfile="${path_REPODIR}"'/'"${pseudname}"'/.gitconfig'
- baredir="${path_REPODIR}/${reponame}.git"
## If the pseud directory does not exist within `${path_REPODIR}´, it
## is created.
"${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