logo

oasis

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

commit.sh (661B)


  1. set -e
  2. if [ "$#" != 4 ] ; then
  3. echo 'usage: commit.sh repo branch tag out' >&2
  4. exit 2
  5. fi
  6. repo=$1
  7. branch=$2
  8. tag=$3
  9. out=$4
  10. if commit=$(git -C "$repo" show-ref -s --verify "refs/heads/$branch" 2>/dev/null) ; then
  11. oldtree=$(git -C "$repo" rev-parse --verify "$branch^{tree}")
  12. newtree=$(git -C "$repo" rev-parse --verify "$tag^{tree}")
  13. if [ "$oldtree" != "$newtree" ] ; then
  14. set -- -p "$branch"
  15. unset commit
  16. fi
  17. else
  18. set --
  19. unset commit
  20. fi
  21. if [ -z "${commit+set}" ] ; then
  22. commit=$(git -C "$repo" commit-tree -m "oasis $(git rev-parse --short=10 HEAD)" "$@" "$tag")
  23. git -C "$repo" update-ref "refs/heads/$branch" "$commit"
  24. fi
  25. echo "$commit" >"$out"