summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.ninja1
-rw-r--r--gen.rc1
-rw-r--r--rules.ninja3
-rw-r--r--scripts/commit.rc18
4 files changed, 23 insertions, 0 deletions
diff --git a/config.ninja b/config.ninja
index 8b69bfb5..cee4ed36 100644
--- a/config.ninja
+++ b/config.ninja
@@ -11,3 +11,4 @@ perl = perl
repo = root
repo_tag = tree
+repo_branch = master
diff --git a/gen.rc b/gen.rc
index acb00e0b..373de29a 100644
--- a/gen.rc
+++ b/gen.rc
@@ -5,3 +5,4 @@ file .perms '$outdir'/root.perms 644
build '$builddir/$repo.stamp' gitinit
build '$builddir/$repo.git/refs/tags/$repo_tag' gittree '$outdir/root.tree' '|' '$builddir/$repo.stamp' ./scripts/tree.rc
build '$builddir/$repo.tar' gitarchive '|' '$builddir/$repo.git/refs/tags/$repo_tag'
+build '$builddir/$repo.git/refs/heads/master' gitcommit '|' '$builddir/$repo.git/refs/tags/$repo_tag'
diff --git a/rules.ninja b/rules.ninja
index 17ccec4c..98cff501 100644
--- a/rules.ninja
+++ b/rules.ninja
@@ -43,6 +43,9 @@ rule gittree
command = rc ./scripts/tree.rc $builddir/$repo.git $repo_tag $in
restat = 1
+rule gitcommit
+ command = rc ./scripts/commit.rc $builddir/$repo.git $repo_branch $repo_tag
+
rule gitarchive
command = git -C $builddir/$repo.git archive -o $$PWD/$out $repo_tag
diff --git a/scripts/commit.rc b/scripts/commit.rc
new file mode 100644
index 00000000..21789d72
--- /dev/null
+++ b/scripts/commit.rc
@@ -0,0 +1,18 @@
+#!/bin/rc
+
+flag e +
+
+repo=$1
+branch=$2
+tag=$3
+
+fn checkstatus {}
+
+cd $repo
+
+if([ -f refs/heads/$branch ]) parent=(-p $branch)
+if not parent=()
+
+ifs=() { message='oasis built by '`{id -un | head -c -1} }
+commit=`{echo $message | git commit-tree $tag $parent} ; checkstatus
+git update-ref refs/heads/$branch $commit