summaryrefslogtreecommitdiff
path: root/scripts/hash.rc
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-04-10 02:58:52 -0700
committerMichael Forney <mforney@mforney.org>2016-04-15 02:10:08 -0700
commitdbb513d4572e2eed5e540b7b7fb7e9c8f544cb04 (patch)
tree2260140732591d6ca455e493305884c21f063b3f /scripts/hash.rc
parent5f753e71fa37011b9bf7bcec482fe4a4a904dc9e (diff)
Add some initial packages
Diffstat (limited to 'scripts/hash.rc')
-rw-r--r--scripts/hash.rc21
1 files changed, 21 insertions, 0 deletions
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