summaryrefslogtreecommitdiff
path: root/scripts/tree.rc
blob: bbc2bd34adc8477b895533758318ad2b6ddca339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/rc

flag e +

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

fn checkstatus {}

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

if([ -e $out ]) {
	oldtree=`{cat $out} ; checkstatus
	if(~ $tree $oldtree)
		exit 0
}

echo $tree >$out.tmp
mv $out.tmp $out