summaryrefslogtreecommitdiff
path: root/scripts/commit.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/commit.sh')
-rw-r--r--scripts/commit.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/commit.sh b/scripts/commit.sh
new file mode 100644
index 00000000..b4959f48
--- /dev/null
+++ b/scripts/commit.sh
@@ -0,0 +1,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"