summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-12-29 23:29:07 -0800
committerMichael Forney <mforney@mforney.org>2016-12-29 23:29:07 -0800
commit36c037effc0ce49beaa5e27caed0343e137013a6 (patch)
tree9741abb4eb56e15e2f5b819271b082f7ff9c530b /scripts
parent4a9f8e3cb82e9b04fc7a63146569b997dc01c1e1 (diff)
Allow using /.git as output repository
Diffstat (limited to 'scripts')
-rw-r--r--scripts/commit.rc12
-rw-r--r--scripts/tree.rc19
2 files changed, 17 insertions, 14 deletions
diff --git a/scripts/commit.rc b/scripts/commit.rc
index e7b5d468..870d7ab3 100644
--- a/scripts/commit.rc
+++ b/scripts/commit.rc
@@ -9,13 +9,11 @@ out=$4
fn checkstatus {}
-wd=`{pwd}
-cd $repo
-
-if([ -f refs/heads/$branch ]) parent=(-p $branch)
+if(git -C $repo show-ref -q --verify refs/heads/$branch)
+ parent=(-p $branch)
if not parent=()
message='oasis built by '`{id -un}
-commit=`{echo $message | git commit-tree $tag $parent} ; checkstatus
-git update-ref refs/heads/$branch $commit
-ln -f refs/heads/$branch $wd/$out
+commit=`{echo $message | git -C $repo commit-tree $tag $parent} ; checkstatus
+git -C $repo update-ref refs/heads/$branch $commit
+echo $commit > $out.tmp && mv $out.tmp $out
diff --git a/scripts/tree.rc b/scripts/tree.rc
index 81f641c6..bbc2bd34 100644
--- a/scripts/tree.rc
+++ b/scripts/tree.rc
@@ -9,11 +9,16 @@ out=$4
fn checkstatus {}
-wd=`{pwd}
-cd $repo
+git -C $repo read-tree --empty
+git -C $repo update-index --index-info <$index
+tree=`{git -C $repo write-tree} ; checkstatus
+git -C $repo update-ref refs/tags/$tag $tree
-git read-tree --empty
-git update-index --index-info <$wd/$index
-tree=`{git write-tree} ; checkstatus
-git update-ref refs/tags/$tag $tree
-ln -f refs/tags/$tag $wd/$out
+if([ -e $out ]) {
+ oldtree=`{cat $out} ; checkstatus
+ if(~ $tree $oldtree)
+ exit 0
+}
+
+echo $tree >$out.tmp
+mv $out.tmp $out