summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-04-10 13:31:32 -0700
committerMichael Forney <mforney@mforney.org>2016-04-15 02:10:08 -0700
commit94080b6ea885cfc6e23393fb7e94552e37d58c2e (patch)
treedd8785d1ac2088c3c1ef08903aa3433eebeedf1b
parent04a54a014f45d3564b29858c631b4578211a49ba (diff)
Use git tag file as gittree output
-rw-r--r--gen.rc4
-rw-r--r--rules.ninja3
-rw-r--r--scripts/tree.rc8
3 files changed, 7 insertions, 8 deletions
diff --git a/gen.rc b/gen.rc
index b0bee1bf..80e27fe0 100644
--- a/gen.rc
+++ b/gen.rc
@@ -105,6 +105,8 @@ for(pkg in $packages) subgen core/$pkg
printf '%s\n' $root_perms >$outdir/root_perms.txt
file .perms '$outdir'/root_perms.txt 644
-build '$outdir'/root_tree.txt gittree $root_inputs '| $repo.stamp'
+ninja_vars='tag = tree' {
+ build '$repo/refs/tags/tree' gittree $root_inputs '| $repo.stamp'
+}
for(pkg in $packages) subninja core/$pkg/local.ninja
diff --git a/rules.ninja b/rules.ninja
index c49bc90b..e4c8a519 100644
--- a/rules.ninja
+++ b/rules.ninja
@@ -29,7 +29,8 @@ rule githash
command = rc $root_srcdir/scripts/hash.rc $repo $out $args $in
rule gittree
- command = rc $root_srcdir/scripts/tree.rc $repo $out $in
+ command = rc $root_srcdir/scripts/tree.rc $repo $tag $in
+ restat = 1
rule gitinit
command = mkdir -p $repo && git -C $repo init --bare && touch $out
diff --git a/scripts/tree.rc b/scripts/tree.rc
index 8d71ffe2..ed7a81bb 100644
--- a/scripts/tree.rc
+++ b/scripts/tree.rc
@@ -3,7 +3,7 @@
flag e +
repo=$1
-out=$2
+tag=$2
shift 2
ifs=() { oldpwd=`{pwd | head -c -1} }
@@ -12,8 +12,4 @@ cd $repo
git read-tree --empty
cat $oldpwd/$* | git update-index --index-info
tree=`{git write-tree}
-git update-ref refs/tags/tree $tree
-
-cd $oldpwd
-echo $tree >$out.tmp
-mv $out.tmp $out
+git update-ref refs/tags/$tag $tree