subgit

Git-submodule alternative with vendoring and multiple remotes
git clone https://git.sinitax.com/sinitax/subgit
Log | Files | Refs | sfeed.txt

subgit-write (647B)


      1#!/bin/bash
      2
      3repo=$(realpath "$(git rev-parse --show-toplevel)")
      4
      5echo -e "#!/bin/bash\n" > "$repo/.subgitrc"
      6echo -e "declare -A subgit subgitinfo\n" >> "$repo/.subgitrc"
      7
      8for subrepo in ${!subgit[@]}; do
      9	echo "subgit[$subrepo]=1"
     10	echo "subgitinfo[$subrepo/remote]='${subgitinfo[$subrepo/remote]}'"
     11	echo "subgitinfo[$subrepo/branch]='${subgitinfo[$subrepo/branch]}'"
     12	echo "subgitinfo[$subrepo/commit]='${subgitinfo[$subrepo/commit]}'"
     13	echo ""
     14done >> "$repo/.subgitrc"
     15
     16if [ ! -e "$repo/.gitignore" ]; then
     17	echo "/.gitignore" > "$repo/.gitignore"
     18fi
     19cat "$repo/.gitignore" | grep -q "^/.subgit$" \
     20	|| echo "/.subgit" >> "$repo/.gitignore"