logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

tree.sh (446B)


  1. set -e
  2. if [ "$#" != 4 ] ; then
  3. echo 'usage: tree.sh repo tag index out' >&2
  4. exit 2
  5. fi
  6. repo=$1
  7. tag=$2
  8. index=$3
  9. out=$4
  10. export GIT_INDEX_FILE="$PWD/$out.index"
  11. git -C "$repo" read-tree --empty
  12. git -C "$repo" update-index --index-info <"$index"
  13. tree=$(git -C "$repo" write-tree)
  14. git -C "$repo" update-ref "refs/tags/$tag" "$tree"
  15. printf '%s\n' "$tree" >"$out.tmp"
  16. if cmp -s "$out" "$out.tmp" ; then
  17. rm "$out.tmp"
  18. else
  19. mv "$out.tmp" "$out"
  20. fi