gitrefresh

Easily export, reinitialize and update all git repositories in a file hierarchy
git clone git://git.defalsify.org/gitrefresh.git
Log | Files | Refs | README | LICENSE

commit 43b7ee60cad6fd6ec52dbb04b1b78dd120b5950b
parent a44af7cd1fc8886fa3996faf5d38f48e32993987
Author: lash <dev@holbrook.no>
Date:   Fri, 21 Jan 2022 18:47:28 +0000

Enable dir tree destinations in gitstart

Diffstat:
Mgitstart.sh | 21++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/gitstart.sh b/gitstart.sh @@ -2,16 +2,27 @@ if [ ! -z $1 ]; then pushd $1 fi +if [ -z GITREFRESH_CHECKOUT ]; then + gitargs='--bare' +fi + while IFS= read -r repo; do - basename_raw=$(basename $repo) - basename_chomped=${basename_raw%.git} - >&2 echo "checkout repo $basename_chomped ($repo)" - basename_git=${basename_chomped}.git + read -ra parts <<< "$repo" + url=${parts[0]} + if [ -z ${parts[1]} ]; then + basename_raw=$(basename $repo) + basename_chomped=${basename_raw%.git} + >&2 echo "checkout repo $basename_chomped ($repo)" + basename_git=${basename_chomped}.git + else + basename_git=${parts[1]} + fi if [ -e $basename_git ]; then >&2 echo "folder $basename_git already exists, skipping" continue fi - git clone --bare $repo $basename_git + echo "clone $url to $basename_git" + git clone $gitargs $url $basename_git done if [ ! -z $1 ]; then