git-repo

Tools for sharing git bare repositories
git clone git://git.meso-star.fr/git-repo.git
Log | Files | Refs | README | LICENSE

commit ab81dedde3179727efe122f88cdbecdd7fdf4b79
parent d3ea9a9df63e792ce68a4fed4817cc9078727581
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 25 Sep 2024 16:58:30 +0200

Improving portability on older git versions

The --initial-branch option in git-init and the --absolute-git-dir
option in git-rev-parse were not available on older versions of git
still in use.

Diffstat:
Mgit-repo | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/git-repo b/git-repo @@ -80,6 +80,7 @@ dumb() # git_dir, dumb ######################################################################## # The script ######################################################################## +cur="$(pwd)" dumb=0 group="" @@ -109,7 +110,7 @@ fi if [ ! -e "${repo}" ]; then mkdir -p "${repo}" || die "$?" - git init --bare --initial-branch=master "${repo}" + git init --bare "${repo}" fi if [ ! -d "${repo}" ]; then @@ -119,7 +120,7 @@ fi cd -- "${repo}" -if ! git_dir=$(git rev-parse --absolute-git-dir 2>&1); then +if ! git_dir=$(git rev-parse --git-dir 2>&1); then >&2 printf '%s: %s\n' "${repo}" "${git_dir}" die fi @@ -131,7 +132,11 @@ if ! git_bare=$(git rev-parse --is-bare-repository) \ die fi -cd "${OLDPWD}" +# Retrieve absolute path of the git directory +cd -- "${git_dir}" +git_dir="$(pwd)" + +cd -- "${cur}" share "${repo}" "${group}" dumb "${git_dir}" "${dumb}"