summaryrefslogtreecommitdiff
path: root/scripts/commit.sh
blob: b4959f48d9b868168d6b0d95ae7342f6f2389d25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
set -e

repo=$1
branch=$2
tag=$3
out=$4

if git -C "$repo" show-ref -q --verify "refs/heads/$branch" ; then
	set -- -p "$branch"
else
	set --
fi

commit=$(git -C "$repo" commit-tree -m "oasis built by $(id -un)" "$@" "$tag")
git -C "$repo" update-ref "refs/heads/$branch" "$commit"
echo "$commit" >"$out.tmp" && mv "$out.tmp" "$out"