From dbb513d4572e2eed5e540b7b7fb7e9c8f544cb04 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 10 Apr 2016 02:58:52 -0700 Subject: Add some initial packages --- scripts/hash.rc | 21 +++++++++++++++++++++ scripts/tree.rc | 19 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 scripts/hash.rc create mode 100644 scripts/tree.rc (limited to 'scripts') diff --git a/scripts/hash.rc b/scripts/hash.rc new file mode 100644 index 00000000..9b715308 --- /dev/null +++ b/scripts/hash.rc @@ -0,0 +1,21 @@ +#!/bin/rc + +flag e + + +repo=$1 +out=$2 +mode=$3 +name=$4 +shift 4 + +hash=`{ + switch($mode) { + case 120??? + printf %s $1 | git -C $repo hash-object -w --stdin + case 100??? + git -C $repo hash-object -w --stdin <$1 + } +} + +printf '%s %s\t%s\n' $mode $hash $name >$out.tmp +mv $out.tmp $out diff --git a/scripts/tree.rc b/scripts/tree.rc new file mode 100644 index 00000000..8d71ffe2 --- /dev/null +++ b/scripts/tree.rc @@ -0,0 +1,19 @@ +#!/bin/rc + +flag e + + +repo=$1 +out=$2 +shift 2 + +ifs=() { oldpwd=`{pwd | head -c -1} } +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 -- cgit v1.2.3